Skip to content

Add reason argument to set_status() so that custom messages flow #284

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

Merged

Conversation

kevin-bates
Copy link
Member

Without adding a named argument of reason to tornado's set_status()
method, messages associated with a thrown HTTPError will not be returned
to the caller. Instead, the reason corresponding to the built-in status
code is returned. In addition, because the reason argument is used,
enforcement of a built in status code is skipped, thereby allowing for
the optional use of non-builtin status codes.

Fixes #283

@kevin-bates kevin-bates requested a review from parente April 23, 2018 21:50
@kevin-bates
Copy link
Member Author

Hmm - looks like this breaks the tests. Need to determine what's going on here.

kevin-bates added a commit to kevin-bates/enterprise_gateway that referenced this pull request Apr 23, 2018
This PR also requires [Kernel Gateway PR 284](jupyter-server/kernel_gateway#284)

In absence of that PR, the default message corresponding to the status code will
be returned to the caller.  So this PR is essentially preparation to have custom
error messages returned.

Fixes jupyter-server#296
kevin-bates added a commit to kevin-bates/enterprise_gateway that referenced this pull request Apr 23, 2018
This PR also requires [Kernel Gateway PR 284](jupyter-server/kernel_gateway#284)

In absence of that PR, the default message corresponding to the status code will
be returned to the caller.  So this PR is essentially preparation to have custom
error messages returned.

Fixes jupyter-server#296
Without adding a named argument of `reason` to tornado's `set_status()`
method, messages associated with a thrown HTTPError will not be returned
to the caller.  Instead, the reason corresponding to the built-in status
code is returned.  In addition, because the reason argument is used,
enforcement of a built in status code is skipped, thereby allowing for
the optional use of non-builtin status codes.

Updated the TestableJSONErrorsHandler class to have a compatible signature
to Torado's `set_status()` method (to include the `reason` parameter).

Fixes jupyter-server#283
@kevin-bates kevin-bates force-pushed the enable-custom-error-messages branch from de82378 to 81c8a12 Compare April 24, 2018 00:03
@kevin-bates
Copy link
Member Author

I've amended the PR such that TestableJSONErrorsHandler has a compatible set_status() signature to that of Tornado's.

@parente
Copy link
Contributor

parente commented Apr 24, 2018

PR seems reasonable to me. (Pun intended.) Thanks @kevin-bates!

@parente parente merged commit c1a1c50 into jupyter-server:master Apr 24, 2018
@kevin-bates kevin-bates deleted the enable-custom-error-messages branch April 26, 2018 18:26
lresende pushed a commit to jupyter-server/enterprise_gateway that referenced this pull request May 2, 2018
This PR also requires [Kernel Gateway PR 284](jupyter-server/kernel_gateway#284)

In absence of that PR, the default message corresponding
to the status code will be returned to the caller.

This PR is essentially preparation to have custom
error messages returned.

Fixes #296
Closes #310
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 this pull request may close these issues.

2 participants