Skip to content

Commit 7ac27fe

Browse files
author
hirsch88
committed
only print error stack in dev env
1 parent 64a7089 commit 7ac27fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/api/exceptionHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { my } from 'my-express';
2+
import { Environment } from '../Environment';
23
import { Exception, isException } from '../api/Exception';
34

45
/**
@@ -12,7 +13,9 @@ export const exceptionHandler = (error: Exception | Error, req: my.Request, res:
1213
res.failed(error['code'], error.message, error['body'] || null);
1314
next();
1415
} else {
15-
console.error(error.stack);
16+
if (Environment.isDevelopment()) {
17+
console.error(error.stack);
18+
}
1619
res.failed(500, 'Something broke!', error['body'] || null);
1720
next(error);
1821
}

0 commit comments

Comments
 (0)