I'm trying to catch all exceptions that may happen and output the stack details as message in FlaskRestPlus.
The below is an example that works if I raise custom exception such as RootException
. But I didn't manage to get it to work with BaseException
or anything else that might serve as a catch all. I also didn't find a way to output the stack (or original error message) into the message body.
@api.errorhandler(RootException)
def handle_root_exception(error):
return {'message': 'Here I want the original error message'}, 500
Any suggestions how I can achieve this would be highly appreciated. THe documentation doesn't seem to be entirely clear: https://flask-restplus.readthedocs.io/en/stable/errors.html