From 7592805eea88b1d5f2bbf53e0482b57cee9f2424 Mon Sep 17 00:00:00 2001 From: Harsha Srikara Date: Tue, 3 Nov 2020 11:40:43 -0600 Subject: [PATCH] updates based on requested changed --- functions/src/express_configs/express_open.ts | 9 ++------- functions/src/express_configs/express_secure.ts | 2 +- functions/src/index.ts | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/functions/src/express_configs/express_open.ts b/functions/src/express_configs/express_open.ts index 627403e..3e07490 100644 --- a/functions/src/express_configs/express_open.ts +++ b/functions/src/express_configs/express_open.ts @@ -37,13 +37,8 @@ app.use(bodyParser.urlencoded({ extended: true })); // The error handler must be before any other error middleware and after all controllers app.use( Sentry.Handlers.errorHandler({ - shouldHandleError(error) { - // Capture all errors over 400 - if ((error.status as number) >= 400) { - return true; - } - return false; - }, + // report the error to sentry if >=400 + shouldHandleError: (error) => (error.status as number) >= 400, }) ); diff --git a/functions/src/express_configs/express_secure.ts b/functions/src/express_configs/express_secure.ts index 74cf7ca..15af79b 100644 --- a/functions/src/express_configs/express_secure.ts +++ b/functions/src/express_configs/express_secure.ts @@ -62,7 +62,7 @@ function errorHandler(error: Error, request: Request, response: Response, next: app.use(errorHandler); // Automatically send uncaught exception errors to Sentry -process.on("uncaughtException", (error) => Sentry.captureException(error)); +process.on("uncaughtException", (err) => Sentry.captureException(err)); const checkJwt = jwt({ secret: jwksRsa.expressJwtSecret({ diff --git a/functions/src/index.ts b/functions/src/index.ts index c52223b..d04fdd5 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -16,7 +16,7 @@ import * as eventFunctions from "./events/events"; import * as vanityFunctions from "./custom/vanity"; import * as hacktoberfestFunctions from "./custom/hacktoberfest"; import * as typeformFunctions from "./application/typeform"; -import * as errorFunctions from "./services/ErrorService"; +import * as errorFunctions from "./services/errorService"; //this will match every call made to this api. app_secure.all("/", (request, response, next) => {