mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 19:33:05 +00:00
Include request info in errors
This commit is contained in:
1 parent
3133c50e55
commit
db83922644
4 files changed
+5
-5
No files matched your search
Binary file not shown.
@@ -60,7 +60,6 @@
|
||||
Cmd = [ "${self.outputs.packages.${system}.default}/bin/start-${mod}" ];
|
||||
Expose = [ "3001" ];
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
+3
-2
@@ -97,8 +97,9 @@ export class SpacebarServer extends Server {
|
||||
// Emma [it/its] @ Rory& - the _ is required now, as pillarjs throw an error if you don't pass a param name now
|
||||
api.use("*_", (req: Request, res: Response) => {
|
||||
res.status(404).json({
|
||||
message: "404 endpoint not found",
|
||||
code: 0,
|
||||
message: "Endpoint not found",
|
||||
code: 404,
|
||||
request: `${req.method} ${req.url}`,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ export function ErrorHandler(error: Error & { type?: string }, req: Request, res
|
||||
|
||||
if (httpcode > 511) httpcode = 400;
|
||||
|
||||
res.status(httpcode).json({ code: code, message, errors, _ajvErrors });
|
||||
res.status(httpcode).json({ code, message, errors, _ajvErrors, request: `${req.method} ${req.url}` });
|
||||
} catch (error) {
|
||||
console.error(`[Internal Server Error] 500`, error);
|
||||
return res.status(500).json({ code: 500, message: "Internal Server Error" });
|
||||
return res.status(500).json({ code: 500, message: `Internal server error while handling error`, request: `${req.method} ${req.url}` });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user