Ludochaordic
Fantaisies programatico-ludiques

Displaying chained exceptions stacktraces in Python 2

At work we have a component not yet migrated to Python 3, and we recently had some difficulties diagnosing a problem with the MySQL connector. Because we were catching the mysql.connector.errors.Error and raising a custom exception, we were loosing the underlying stacktrace and hence couldn't troubleshoot the …

Read More

Disabling error stack traces with SpringBoot, but only in prod

Simply add the following class to your project. It will be automatically registered at start-up if you use the @EnableAutoConfiguration annotation : @ControllerAdvice // Makes this the default behaviour of all controllers @ConditionalOnProperty(prefix = "app", name = "disable-default-exception-handling") class GlobalControllerExceptionHandler { @ExceptionHandler(Exception.class) // Catch any exception @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) // Returns an error code …

Read More

Quickly finding where you PHP script is stuck

First, install PHP debugging extensions for gdb, for example: debuginfo-install php-5.6.8 # if you use yum aptitude install php5-dbg # if you use aptitude Then simply: php_version=5.6.8 php_script_pid=$(pgrep -f $php_script_name) curl https://raw.githubusercontent.com/php/php-src/PHP-$php_version/.gdbinit >> ~/.gdbinit gdb -p $php_script_pid dump_bt executor_globals …

Read More