File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,4 @@ export default function init() {
5252 } ;
5353
5454 client . on ( "error" , errorHandler ) ;
55- process . on ( "uncaughtException" , errorHandler ) ;
56- process . on ( "unhandledRejection" , errorHandler ) ;
5755}
Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ const app = express();
88
99app . use ( express . static ( path . join ( __dirname , ".." , "public" ) ) ) ;
1010
11- app . get ( "/butts" , ( req , res ) => {
12- res . send ( "butts" ) ;
13- } ) ;
11+ /**
12+ Route handlers and static hosting
13+ */
14+
15+ app . use ( express . static ( path . join ( __dirname , ".." , "public" ) ) ) ;
1416
1517// needs to handle all verbs (GET, POST, etc.)
1618app . all (
@@ -32,3 +34,15 @@ app.all(
3234app . listen ( process . env . PORT || "3000" ) ;
3335
3436discordBot ( ) ;
37+
38+ const errorHandler = ( error : unknown ) => {
39+ Sentry . captureException ( error ) ;
40+ if ( error instanceof Error ) {
41+ console . log ( "ERROR" , error . message ) ;
42+ } else if ( typeof error === "string" ) {
43+ console . log ( "ERROR" , error ) ;
44+ }
45+ } ;
46+
47+ process . on ( "uncaughtException" , errorHandler ) ;
48+ process . on ( "unhandledRejection" , errorHandler ) ;
You can’t perform that action at this time.
0 commit comments