-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Save HTTP exception description as a property of HttpException #5809
Comments
In the meantime, you can use this: Object.getPrototypeOf(exception).constructor.name as w workaround |
I think that it would be nice to be able to get a human-readable description of an error ( |
Added a method to set name property of exception object equal to class name which currently is always Error Closes nestjs#5809
Added a method to set name property of exception object equal to class name which currently is always Error. Updated tests. Closes nestjs#5809
Added a method to set name property of exception object equal to class name which currently is always Error. Updated tests. Closes nestjs#5809
You could always generate a human-readable description based on the serialized class names (e.g., by adding spaces between uppercased characters). Let's track this here #5859 |
Hi there, sorry to resurrect this issue, but I think I experience something that is related and thus not yet fixed. I have two files, a service and a controller. In the service, I perform an API call. When this API call returns a response indicating that I am unauthorized, I throw a
However,
...and:
Since |
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements. |
Feature Request
Is your feature request related to a problem? Please describe.
I have an issue when implementing a custom ExceptionFilter for an MVC application. When the exception filter catches a HttpException, I want to render a template with HTTP error code, description, and message (e.g.
401 Unauthorized: Wrong username or password
). While I can easily get error code and message, getting the HTTP error description (Unauthorized
in this case) is harder than it should be: it is stored in theerror
property of JSON response. At the same time HttpException has aname
property, that is always initialized to'Error'
.Describe the solution you'd like
I'd like the
name
property of HttpException to be initialized with HTTP error description.Teachability, Documentation, Adoption, Migration Strategy
Here is how it can be used:
The text was updated successfully, but these errors were encountered: