Hello there,
I am developing an API server and have to design API strictly managed.
So I want to handle exceptions in the form my API usually responds, but it seems
that I cannot control the handler manually.
I have tried to mimic the classes except for the error handler but I failed because the coupling of the classes are too dense to separate.
Is there any way that I can use flask original error handler only?
I have to handle 200, 400, 401, 403, 404, 405, 429, 500 in the same form.
I am working around like this
from flask_restful import Api as _Api
class Api(_Api):
def error_router(self, original_handler, e):
return original_handler(e)
Same here, flask-restful seems to be stopping all my exceptions from being handled in the actual Flask app.
Using app.config[鈥楶ROPAGATE_EXCEPTIONS鈥橾 = True in the main Flask app allows us to handle them.
Most helpful comment
I am working around like this