[ ] Have a new custom exception service, which can e.g.
[ ] Only gives out JSON
[ ] Gives valid Status code responses, e.g. 400 on User errors; 500 on unknown errors, 404 on missing objects, 422 for potential Developer-errors and so on
[ ] Translate Django own HTML responses (e.g. for 500) into correct JSON
[ ] Implement the custom_exception_handler also in the emails project and make sure, all errors from the API come correctly
☝️What is it? Why do we need it?
django-rest-framework
works great but the exception handling is not as good because it mixes HTML responses (e.g. 404 or 500) with JSON responsesFor the API the format should be consistent:
Please write a custom exception handler which we can use in all kind of projects, documentation on this is here: https://www.django-rest-framework.org/api-guide/exceptions/#custom-exception-handling
📋 Todos
400
on User errors; 500 on unknown errors, 404 on missing objects, 422 for potential Developer-errors and so on