How can we catch or/and handle all unhandled exceptions in ruby?
The motivation for this is maybe logging some kind of exceptions to different files or send and e-mail to the system administration, for example.
In Java we will do
Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler ex);
In NodeJS
process.on('uncaughtException', function(error) {
/*code*/
});
In PHP
register_shutdown_function('errorHandler');
function errorHandler() {
$error = error_get_last();
/*code*/
}
How can we do this with ruby?