From c6af18eb7b5f69edd2590045b1603d3ea42b0a45 Mon Sep 17 00:00:00 2001 From: Stefan Mendoza Date: Thu, 27 Jul 2023 09:41:51 -0400 Subject: [PATCH] [controller] Fix bug in error handling (#54) --- server/src/controllers/Controller.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/controllers/Controller.ts b/server/src/controllers/Controller.ts index 01ebd3e..cceab4d 100644 --- a/server/src/controllers/Controller.ts +++ b/server/src/controllers/Controller.ts @@ -21,10 +21,11 @@ export default class Controller { static sendError(response, error) { response.status(500); - if (error.error instanceof Object) { - response.json(error.error); + + if (error instanceof Object) { + response.json(error); } else { - response.end(error.error || error.message); + response.end(error); } }