You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a server encounters multiple problems for a single request, the most generally applicable HTTP error code SHOULD be used in the response. For instance, 400 Bad Request might be appropriate for multiple 4xx errors or 500 Internal Server Error might be appropriate for multiple 5xx errors.
I like this, I need to cleanup the controller's multi errors and depending on what the errors are I can decide what code. So if I have mainly 4XX errors then I set the MultiCallError code to 400, if they're a bunch of ValueErrors or something like that then I set it to 500.
The text was updated successfully, but these errors were encountered:
Basically, MultiCallError should have an add method that will aggregate any CallErrors under the status code (so all 400-499) errors would be aggregated under 400. Any other errors would aggregate under 500, whichever one (400 or 500) has the most errors will be the error that gets raised, this could be done like this:
e=MultiCallError()
e.add(CallError(401))
e.add(CallError(403))
e.add(ValueError()) # would be considered a 500e.raise() # would raise a new CallError(400) because there were 2 400 level errors
Inspired by jsonapi:
I like this, I need to cleanup the controller's multi errors and depending on what the errors are I can decide what code. So if I have mainly 4XX errors then I set the MultiCallError code to 400, if they're a bunch of ValueErrors or something like that then I set it to 500.
The text was updated successfully, but these errors were encountered: