Skip to content

Add ability to return custom error messages. #283

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

Closed
kevin-bates opened this issue Apr 23, 2018 · 0 comments
Closed

Add ability to return custom error messages. #283

kevin-bates opened this issue Apr 23, 2018 · 0 comments
Assignees

Comments

@kevin-bates
Copy link
Member

This is related to Enterprise Gateway Issue 296. With the current implementation of JSONErrorsMixin.write_error() it is not possible to do the following:

  1. Return custom error text associated with a status code.
  2. Return custom status codes.

By extending the set_status() method with a reason named argument, both of the above can happen.

@kevin-bates kevin-bates self-assigned this Apr 23, 2018
kevin-bates added a commit to kevin-bates/kernel_gateway that referenced this issue Apr 23, 2018
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 jupyter-server#283
kevin-bates added a commit to kevin-bates/kernel_gateway that referenced this issue Apr 24, 2018
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant