summary refs log tree commit diff
path: root/api/src/middlewares
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:26:47 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:26:47 +0200
commit2e9f36b66ad99140fe1312a8b2bdfaf7b0e9d6bb (patch)
treefcd3733bf36327c988c95892d548d4e5d628f505 /api/src/middlewares
parent:bug: api member add roles -> make sure that roles exist (diff)
parentfixed /discoverable-guilds (diff)
downloadserver-2e9f36b66ad99140fe1312a8b2bdfaf7b0e9d6bb.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-api
Diffstat (limited to 'api/src/middlewares')
-rw-r--r--api/src/middlewares/ErrorHandler.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts
index 179c5991..be2586cf 100644
--- a/api/src/middlewares/ErrorHandler.ts
+++ b/api/src/middlewares/ErrorHandler.ts
@@ -2,9 +2,8 @@ import { NextFunction, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
 import { EntityNotFoundError } from "typeorm";
 import { FieldError } from "../util/instanceOf";
-import { ApiError } from "../util/ApiError";
+import { ApiError } from "@fosscord/util";
 
-// TODO: update with new body/typorm validation
 export function ErrorHandler(error: Error, req: Request, res: Response, next: NextFunction) {
 	if (!error) return next();
 
@@ -20,7 +19,7 @@ export function ErrorHandler(error: Error, req: Request, res: Response, next: Ne
 			message = error.message;
 			httpcode = error.httpStatus;
 		} else if (error instanceof EntityNotFoundError) {
-			message = `${(error as any).stringifyTarget} could not be found`;
+			message = `${(error as any).stringifyTarget || "Item"} could not be found`;
 			code = 404;
 		} else if (error instanceof FieldError) {
 			code = Number(error.code);