Configurable error handler and exception handler