Unhandled exceptions in a RESTful API are not getting jsonify'ed Unhandled exceptions in a RESTful API are not getting jsonify'ed flask flask

Unhandled exceptions in a RESTful API are not getting jsonify'ed


This because Flask-Restful monkeypatch default Flask.handle_user_exception which will have specific logic for Flask-Restful endpoints and default behaviour for other endpoints.


Flask-Restful has its own error handler, the JSON output that you are seeing from /test2 is being generated by the extension itself.

You can override Flask-Restful's exception if you register a new exception handler via Flask's handle_exception call.