Flask-Restful taking over exception handling from Flask during non debug mode

Viewed 1795

I've used Flask's exception handling during development (@app.errorhander(MyException)) which worked fine even for exceptions coming from Flask-Restful endpoints.

However, I noticed that when switching to debug=False, Flask-Restful is taking over the exception handling entirely (as with this propagate_exceptions is False too). I like that Flask-Restful is sending internal server errors for all unhandled exceptions, but unfortunately this also happens for those that have a Flask exception handler (when these exceptions are coming from a Flask-Restful endpoint).

Is there a way to tell Flask-Restful to only handle exceptions that the Flask error handler wouldn't handle? If not, can I exclude certain exception types from being handled by Flask-Restful, so they get handled by Flask?

My last option is to override Flask-Restful's Api.handle_error and implement this logic myself, but I'd like to use existing APIs first...

1 Answers
Related