inveniosoftware / flask-resources

REST APIs for Flask
https://flask-resources.readthedocs.io
MIT License
3 stars 21 forks source link

errors: use`error_handlers` of the view #52

Closed fenekku closed 4 years ago

fenekku commented 4 years ago

Story around error seriliazation needs to be completed: we need to mimic more generally invenio-rest in flask-resources.

Let's use error_handlers to do the work for us.

fenekku commented 4 years ago

Turns out that using error_handler would require a refactor of resource_requestctx first:

By the time error_handler is called, the exception has bubbled up outside of the context manager. So we don't have access to it anymore and it holds the response_handler which we need to serialize errors.

By refactoring per https://github.com/inveniosoftware/flask-resources/issues/2 the context will still be available (I think... :sweat_smile: ). In any case, decorators have been used for now.