在我的Flask应用程序中,我可以通过errorhandler为每个错误代码添加装饰器来轻松扩展由单个自定义错误处理程序处理的错误列表,如同
@application.errorhandler(404)
@application.errorhandler(401)
@application.errorhandler(500)
def http_error_handler(error):
return flask.render_template('error.html', error=error), error.code
Run Code Online (Sandbox Code Playgroud)
但是,此方法需要为每个错误代码使用显式装饰器.有没有办法装饰我的(单个)http_error_handler函数,以便它处理所有 HTTP错误?