def error_handler(f):
@wraps(f)<EOL>def error_handling_function(*args, **kwargs):<EOL><INDENT>@inject(error_config=ErrorConfiguration)<EOL>def get_error_configuration(error_config):<EOL><INDENT>return error_config<EOL><DEDENT>def should_skip_handling():<EOL><INDENT>use_flask_handler = get_error_configuration().use_flask_handler<EOL>is_web_request = isinstance(JobContext.get_current_context(), WebJobContext)<EOL>return use_flask_handler and is_web_request<EOL><DEDENT>try:<EOL><INDENT>return f(*args, **kwargs)<EOL><DEDENT>except Exception as ex:<EOL><INDENT>if should_skip_handling():<EOL><INDENT>raise<EOL><DEDENT>for ep in _error_processors:<EOL><INDENT>ep.handle(ex)<EOL><DEDENT>for eh in _error_handlers:<EOL><INDENT>if eh.can_handle(ex):<EOL><INDENT>return eh.handle(ex)<EOL><DEDENT><DEDENT>return _DEFAULT_ERROR_HANDLER.handle(ex)<EOL><DEDENT><DEDENT>return error_handling_function<EOL>
Default error handler.
 - On server side error shows a message
   'An error occurred!' and returns 500 status code.
 - Also serves well in the case when the resource/task/method
   is not found - returns 404 status code.