added error logging to catch-all error handler