summary refs log tree commit diff
path: root/api/src/middlewares
diff options
context:
space:
mode:
authorxnacly <matteogropp@protonmail.com>2021-09-03 20:00:19 +0200
committerxnacly <matteogropp@protonmail.com>2021-09-03 20:00:19 +0200
commit9e1aac7471b7380db0366082242881a910e1be18 (patch)
treed10860fed22f92f1c52b7877e7e34cc86e525a6f /api/src/middlewares
parentMerge pull request #314 from AlTech98/master (diff)
downloadserver-9e1aac7471b7380db0366082242881a910e1be18.tar.xz
fixed 'undefined not found' + error not showing in client
Diffstat (limited to 'api/src/middlewares')
-rw-r--r--api/src/middlewares/ErrorHandler.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts
index 34827cab..d8e44bd7 100644
--- a/api/src/middlewares/ErrorHandler.ts
+++ b/api/src/middlewares/ErrorHandler.ts
@@ -19,8 +19,8 @@ export function ErrorHandler(error: Error, req: Request, res: Response, next: Ne
 			code = error.code;
 			message = error.message;
 			httpcode = error.httpStatus;
-		} else if (error as EntityNotFoundError) {
-			message = `${(error as any).stringifyTarget} could not be found`;
+		} else if (error instanceof EntityNotFoundError) {
+			message = `${(error as any).stringifyTarget || "Item"} could not be found`;
 			code = 404;
 		} else if (error instanceof FieldError) {
 			code = Number(error.code);