refactor: add devMessage field (useful in front-end)
This commit is contained in:
parent
aefbc965ab
commit
ba65c1fe83
3 changed files with 14 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ function error(error: Error, _req: Request, res: Response, _next: NextFunction)
|
|||
return res.status(error.status).json({
|
||||
status: error.status,
|
||||
message: error.message,
|
||||
devMessage: error.devMessage,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ function error(error: Error, _req: Request, res: Response, _next: NextFunction)
|
|||
status: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
message: "Validation error(s).",
|
||||
detail: error.fields,
|
||||
devMessage: "missing_or_invalid_parameter",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -24,6 +26,7 @@ function error(error: Error, _req: Request, res: Response, _next: NextFunction)
|
|||
return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
message: error.message,
|
||||
devMessage: "system_error",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue