diff options
| author | Tom Harley | 2018-04-21 03:06:02 +0100 |
|---|---|---|
| committer | Tom Harley | 2018-04-21 03:06:02 +0100 |
| commit | 09155e88a34c211dd9429a70fde432c062af77e0 (patch) | |
| tree | fc64decd667384a07082d8ced77c6e83e7943af5 /src/errors/errorware.ts | |
| parent | Include authoris/zation headers in CORS (diff) | |
| download | medicine-09155e88a34c211dd9429a70fde432c062af77e0.tar.gz medicine-09155e88a34c211dd9429a70fde432c062af77e0.zip | |
Fix many small file-handling problems
Diffstat (limited to 'src/errors/errorware.ts')
| -rw-r--r-- | src/errors/errorware.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/errors/errorware.ts b/src/errors/errorware.ts index 6d87bcb..e2b5610 100644 --- a/src/errors/errorware.ts +++ b/src/errors/errorware.ts @@ -1,5 +1,7 @@ import { NextFunction, Request, Response } from 'express'; +import { logger } from '../logger'; + /** * General error and error-handling logic for the middleware stack. */ @@ -115,10 +117,11 @@ export type Errorware = export const errorHandler: Errorware = ( err: Error, req: Request, res: Response, next: NextFunction ): void => { + logger.failure(`Responded to ${req.ip}`); if (RequestError.is(err)) { res.status(err.code) .json(err.responseBlock()); } else { - res.send(err); + res.status(500).send(err.stack); } }; |
