Replies: 1 comment
-
you want a custom error handler for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to set the message with a custom exception when calling ctx.throw but the results seem to be the default message for the status code being used. For example, let's say I have the following exception to custom handle 502 Bad Gateway:
In a route I have code similar to the following that calls a service operation:
In someService.doSomething(), it throws the CustomException if an error occurs:
When I test this, the custom message 'Some custom exception message' is not returned in the response body. Instead I am getting 'Bad Gateway'. I was able to get this to work with a custom exception but it seems like the difference is for this latter case, the service is throwing that exception directly instead of as part of error handling of another error. In the case above, it seems like the original error may be taking precedence over the custom exception. Any suggestions on this are appreciated.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions