-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle validation, errors, and business logic in the API consistently #623
Comments
Few suggestions to handle errors.
|
I like the context manager setup, but I don't see how it's exclusive with the |
ApiException is limited to Django rest and cannot be used outside the service layer, while context manager is useful for capturing Custom errors imported from other modules and converting it into a proper API error with custom status codes |
I feel good about using context managers for error handling. |
Now that we have a larger backend team, I think it would be good for whoever takes this issue to write up a technical spec and get it reviewed before proceeding with the refactor. |
One thing to keep in mind when speccing this out is that assuming multiple context managers that we'd want to potentially combine to catch different groups of exceptions (for example, we could have one exclusive to the Django part of the code that just deals in the
|
@silentninja I assigned this to you based on the conversation in #883. |
Problem
Currently, we have validation, error handling, and business logic spread across the
db
module, models, viewsets, and serializers to make the API work. This is confusing to work with.Proposed solution
Additional context
Related to:
db
and set some standards for imports #582The text was updated successfully, but these errors were encountered: