Skip to content
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

Add 'reason' field to JSON error responses #2958

Merged

Conversation

kevin-bates
Copy link
Member

During the deprecation/removal of the @json_errors decorator, the
reason field was not carried forward into the compatible replacement
method APIHandler.write_error. This broke some client (tests) that
relied on that field's presence.

Fixes #2957.

During the deprecation/removal of the `@json_errors` decorator, the
`reason` field was not carried forward into the compatible replacement
method `APIHandler.write_error`.  This broke some client (tests) that
relied on that field's presence.

Fixes jupyter#2957.
@takluyver
Copy link
Member

@kevin-bates looking back at the old decorator code before #2853, it set reason to e.reason when e is an HTTPError, and None otherwise. I'd suggest that we replicate that.

@kevin-bates
Copy link
Member Author

@takluyver - yeah, that's probably the best approach. Change committed.

@takluyver
Copy link
Member

Thanks. I'll merge tomorrow if no-one says otherwise.

@takluyver takluyver merged commit 9a5c2c0 into jupyter:master Nov 1, 2017
@kevin-bates kevin-bates deleted the fix-2957-add-reason-to-json-errors branch November 1, 2017 15:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

APIHandler.write_error should set reason field in JSON error response.
3 participants