-
Notifications
You must be signed in to change notification settings - Fork 20
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
Different error message for dev and prod environments #67
Comments
I don't think that's possible with the library at the moment. However, I don't think that's a good practice either. For one, it would be the source of all kinds of confusion why the app behaves differently in dev. |
If this is used on the site frontend, it's not safe to show real error messages. Don't you think so? |
It depends on the errors. If it's a business error though (eg. some resource cannot be found), you can convert the error to a Twirp error, specifying a message and an error code. But I assume this is not the case here. |
Are you talking about errors that I throw myself(TwirpError)? |
I think it's possible by passing custom response factory to the generated server constructor. |
Yes, you should convert business errors to twirp errors manually.
Yep, that's one way to do it. Implementing interceptors might also be a good way. I'm closing this issue for now. If you want to continue the discussion, please start a new one under Discussions. Thanks! |
Is there a way for different environments (development, production) to use different error descriptions?
For example, in a dev environment, errors can be displayed completely:
But in the prod environment the original error message should be hidden:
Is there any possibility to implement this?
The text was updated successfully, but these errors were encountered: