Global error handler for any exception

前端 未结 6 1629
旧时难觅i
旧时难觅i 2020-12-04 18:07

Is there a way to add a global catch-all error handler in which I can change the response to a generic JSON response?

I can\'t use the got_request_exception

6条回答
  •  粉色の甜心
    2020-12-04 18:13

    If the Exceptions doesn't work, you may try app.register_error_handler (or use app.errorhandler in a non-decorator way)

    Source: https://github.com/pallets/flask/issues/1837

提交回复
热议问题