Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created July 14, 2020 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/bd1fbae64c7afc03ba3bebe8cf9a5f80 to your computer and use it in GitHub Desktop.
Save velotiotech/bd1fbae64c7afc03ba3bebe8cf9a5f80 to your computer and use it in GitHub Desktop.
/// Print API errors
// eslint-disable-next-line @typescript-eslint/no-unused-vars
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
logger.error(err.message, err);
return res.status(BAD_REQUEST).json({
error: err.message,
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment