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

JSONErrorsMixin not returning correct results after Notebook 5.2.0 is installed #262

Closed
kevin-bates opened this issue Oct 18, 2017 · 0 comments · Fixed by #263
Closed

JSONErrorsMixin not returning correct results after Notebook 5.2.0 is installed #262

kevin-bates opened this issue Oct 18, 2017 · 0 comments · Fixed by #263

Comments

@kevin-bates
Copy link
Member

This is related to Notebook Issue 2942.

One of the changes in Notebook 5.2.0 was the removal of the @json_errors decorator via PR 2853. Instead, much of the equivalent code was moved into the APIHandler.write_error method. However, by virtue of the decorator's removal and the inheritance hierarchy, the JSONErrorsMixin.write_error method is called instead of APIHandler.write_error. JSONErrorsMixin.write_error doesn't handle the traceback functionality present in @json_errors (or APIHandler) and results in the breakage of the TestCustomDefaultKernel test.

Since APIHandler.write_error should be doing the equivalent of @json_errors, I commented out the subclassing of JSONErrorsMixin from some of the handler classes, but then encountered a different set of test errors - these relating to no reason field on HTTP errors. It turns out that one of the pieces of functionality in @json_errors not "transferred" to APIHandler was the appropriate setting of the reason code.

Since its not sufficient to fallback to using APIHandler, we should make the appropriate changes to JSONErrorsMixin.write_error in order to bridge the gap between Notebook 5.2 GA and the future release that addresses the APIHandler/reason issue.

kevin-bates added a commit to kevin-bates/kernel_gateway that referenced this issue Oct 18, 2017
After Notebook 5.2.0 is installed, JSONErrorsMixin.write_error is
used to convert errors into JSON responses.  Previously, Notebook's
`@json_errors` decorator performed this action. Since the decorator's
replacement, `APIHandler.write_error`, doesn't adequately set the
`reason` field, other tests fail so its not sufficient to drop the
use of JSONErrorsMixin.  As a result, JSONErrorsMixin now incorporates
the appropriate code from `APIHandler.write_error` (in particular the
setting of the `traceback` field) - in addition to appropriately
setting the `reason` field.  This mixin should continue to be used
in the handler class hierachy until `APIHandler` is fixed.

I have tested these changes with Notebook 5.1.0 and 5.2.0 installed.
parente added a commit that referenced this issue Oct 31, 2017
Fix #262: JSONErrorsMixin not returning correct results
parente pushed a commit that referenced this issue Nov 11, 2017
After Notebook 5.2.0 is installed, JSONErrorsMixin.write_error is
used to convert errors into JSON responses.  Previously, Notebook's
`@json_errors` decorator performed this action. Since the decorator's
replacement, `APIHandler.write_error`, doesn't adequately set the
`reason` field, other tests fail so its not sufficient to drop the
use of JSONErrorsMixin.  As a result, JSONErrorsMixin now incorporates
the appropriate code from `APIHandler.write_error` (in particular the
setting of the `traceback` field) - in addition to appropriately
setting the `reason` field.  This mixin should continue to be used
in the handler class hierachy until `APIHandler` is fixed.

I have tested these changes with Notebook 5.1.0 and 5.2.0 installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant