feat: Hiding stack traces in production env

This commit is contained in:
MomentQYC 2023-08-13 19:25:58 +08:00
parent 05fff8d4d6
commit 8fc0a3b590
1 changed files with 4 additions and 0 deletions

View File

@ -12,5 +12,9 @@ export class FastifyReplyError extends Error {
super(message);
this.message = message;
this.statusCode = statusCode;
if (process.env.NODE_ENV === 'production') {
Object.defineProperty(this, 'stack', { value: '' });
}
}
}