summary refs log tree commit diff
path: root/api/src/Server.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-17 20:37:13 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-17 20:37:13 +0200
commit70d9aa669e48bcc225c8afa2790fe57151c99277 (patch)
treefb2ccfd601384a8c4bc77220bbd95db78f1f28d5 /api/src/Server.ts
parent:bug: fix login route (diff)
downloadserver-70d9aa669e48bcc225c8afa2790fe57151c99277.tar.xz
:loud_sound: verbose error handler
Diffstat (limited to 'api/src/Server.ts')
-rw-r--r--api/src/Server.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/api/src/Server.ts b/api/src/Server.ts
index ef72df5f..40e7c1c2 100644
--- a/api/src/Server.ts
+++ b/api/src/Server.ts
@@ -5,7 +5,7 @@ import { Authentication, CORS } from "./middlewares/";
 import { Config, db, initEvent } from "@fosscord/util";
 import { ErrorHandler } from "./middlewares/ErrorHandler";
 import { BodyParser } from "./middlewares/BodyParser";
-import { Router, Request, Response } from "express";
+import { Router, Request, Response, NextFunction } from "express";
 import mongoose from "mongoose";
 import path from "path";
 import { initRateLimits } from "./middlewares/RateLimit";
@@ -69,7 +69,8 @@ export class FosscordServer extends Server {
 
 		this.routes = await this.registerRoutes(path.join(__dirname, "routes", "/"));
 
-		api.use("*", (req: Request, res: Response, next) => {
+		api.use("*", (error: any, req: Request, res: Response, next: NextFunction) => {
+			if (error) return next(error);
 			res.status(404).json({
 				message: "404: Not Found",
 				code: 0