mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-24 04:34:55 +02:00
improve path handling and add flags section to config
This commit is contained in:
parent
ce19cc4ba4
commit
50e1a7abe1
6 changed files with 42 additions and 25 deletions
|
@ -8,10 +8,10 @@ export const errorHandlerMiddleware: ErrorRequestHandler = (
|
|||
error,
|
||||
req,
|
||||
res: Response<ErrorResponse>,
|
||||
next: NextFunction,
|
||||
next: NextFunction
|
||||
) => {
|
||||
const statusCode = error.statusCode || HttpCode.INTERNAL_SERVER_ERROR;
|
||||
if (config.app.environment !== "prod") {
|
||||
if (process.env.ENVIRONMENT !== "prod") {
|
||||
logger.error(error);
|
||||
}
|
||||
res?.status(statusCode).send({
|
||||
|
@ -20,6 +20,6 @@ export const errorHandlerMiddleware: ErrorRequestHandler = (
|
|||
error: true,
|
||||
message: error.message || "Internal Server Error",
|
||||
status: statusCode,
|
||||
stack: config.app.environment === "prod" ? null : error.stack,
|
||||
stack: process.env.ENVIRONMENT === "prod" ? null : error.stack,
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue