You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
as we can see in the below code that if we give the custom error that " data not found " and if it is production env it will throw error "InternalServerError" but in dev env it is working fine is there any specific reason that for prod env it is changing the error forcefully itself
This makes production break ideally behaviour should be same in dev and production. We are using tag v7.18.4
Mostly it happening when we are throwing any error from code with the help of exeption from "ts-httpexceptions" module, but we are throwing error with the extends @tsed/exceptions it works fine and not throwing any error for prod env as well.
But this message is only sent when the status code is a 500. So if you emit a 500 for functionnal error, you have problably a design code problem ;)
It should be a 404 error at least
I already answered you it’s for security issue. ErrorFilter is called only for unqualified base Error, that will expose your infrastructure to any hackers. This is the last filter called if any other error filter doesn’t match the class.
Before ErrorFilter, you have the ExceptionFilter, that transform all Exception classes to a json payload.
Because you use an very old exception library, it’s the ErrorFilter that catch your error and not the ExceptionFilter.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
as we can see in the below code that if we give the custom error that " data not found " and if it is production env it will throw error "InternalServerError" but in dev env it is working fine is there any specific reason that for prod env it is changing the error forcefully itself
response .setHeaders(this.getHeaders(error)) .status(err.status) .contentType("application/json") .body(env === Env.PROD ? "InternalServerError" : err);
Beta Was this translation helpful? Give feedback.
All reactions