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

Update error handling on APIHandlers #2853

Merged
merged 4 commits into from Sep 25, 2017

Conversation

Projects
None yet
4 participants
@minrk
Copy link
Member

minrk commented Sep 21, 2017

  • Raise 403 on unauthenticated API requests
    instead of redirecting to login page, which doesn't make sense for API handlers
    and can cause undesirable side effects when using custom login handlers as in JupyterHub
    (jupyterhub/jupyterhub#1438).
  • deprecate @json_errors decorator with write_error method
    on APIHandler, which is the natural and more robust place to implement custom error handling in Tornado.

minrk added some commits Sep 21, 2017

raise 403 on APIHandler failed login
instead of redirecting to human login page, which can have side effects
use .write_error on APIHandler instead of `@json_errors` for JSON err…
…or messages

this is the standard tornado way to do it, and catches errors at the `prepare` stage, which method decorators do not

@takluyver takluyver added this to the 5.2 milestone Sep 21, 2017

@takluyver
Copy link
Member

takluyver left a comment

This looks good to me. I'll leave it for a day or so in case others want to have a look.

@rgbkrk rgbkrk merged commit b2edf89 into jupyter:master Sep 25, 2017

4 checks passed

codecov/patch 84.84% of diff hit (target 0%)
Details
codecov/project Absolute coverage decreased by -0.12% but relative coverage increased by +5.47% compared to aa58dcb
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@minrk minrk deleted the minrk:api-403 branch Oct 10, 2017

@gnestor gnestor modified the milestone: 5.2 Oct 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
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.