Improved error logging on uncaught Errors