-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Error codes #4550
Error codes #4550
Conversation
|
||
* `.detail` - Return the textual description of the error. | ||
* `.get_codes()` - Return the code identifier of the error. | ||
* `.full_details()` - Retrun both the textual description and the code identifier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo Retrun
Awesome \o/ |
Yeah, takes out a little bit of pain for writing the custom exception handlers. What would be great to see come out of this would be one or two third party packages for exception handlers that you can plug in with just a couple of lines of installation. |
Also pleased how this has come out - |
else: | ||
msg = _('Must include "username" and "password".') | ||
raise serializers.ValidationError(msg) | ||
raise serializers.ValidationError(msg, code='authorization') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the codes be different from each other here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily. We're not trying to identify every possible case, just a categorization. If uses want to have specific codes for those different cases then that's simple enough to do by customizing this.
Refs #3775.
TODO: