File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
import "./polyfill" ;
2
2
import { initServer } from "./server" ;
3
+ import { logger } from "./utils/logger" ;
3
4
import { initWorker } from "./worker" ;
4
5
5
6
const main = async ( ) => {
@@ -8,3 +9,26 @@ const main = async () => {
8
9
} ;
9
10
10
11
main ( ) ;
12
+
13
+ // Adding handlers for `uncaughtException` & `unhandledRejection`
14
+ // Needs to be root level of your application to ensure it
15
+ // catches any unhandledRejections or uncaughtException that occur throughout
16
+ // entire codebase
17
+
18
+ process . on ( "uncaughtException" , ( err ) => {
19
+ logger ( {
20
+ message : "Uncaught Exception" ,
21
+ service : "server" ,
22
+ level : "error" ,
23
+ error : err ,
24
+ } ) ;
25
+ } ) ;
26
+
27
+ process . on ( "unhandledRejection" , ( err ) => {
28
+ logger ( {
29
+ message : "Unhandled Rejection" ,
30
+ service : "server" ,
31
+ level : "error" ,
32
+ error : err ,
33
+ } ) ;
34
+ } ) ;
You can’t perform that action at this time.
0 commit comments