From 965a2981afc52b8a1be0af8fbd99cd0b0b25d0c1 Mon Sep 17 00:00:00 2001 From: Ishan Chhabra Date: Wed, 12 Aug 2020 05:16:16 +0000 Subject: [PATCH] fix(analytics): check typeof status before sending --- api/routes/analytics-routes.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/routes/analytics-routes.ts b/api/routes/analytics-routes.ts index 7a3e805..79518b2 100644 --- a/api/routes/analytics-routes.ts +++ b/api/routes/analytics-routes.ts @@ -28,7 +28,10 @@ router.get( return res.status(200).json(data); } catch (error) { console.log(error); - return res.status(error).send(); + if (typeof error === "number") { + return res.status(error).send(); + } + return res.status(500).send(); } } );