diff options
| author | Tom Harley | 2018-04-21 03:07:02 +0100 |
|---|---|---|
| committer | Tom Harley | 2018-04-21 03:07:02 +0100 |
| commit | 4237e378c70c0d6adb3dab4c9ba5cf5385f4a6ec (patch) | |
| tree | 59c487fc0019040448a9713b3c4c146a560ec13d /src/errors | |
| parent | Merge branch 'trh/gets' of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/projec... (diff) | |
| parent | Fix many small file-handling problems (diff) | |
| download | medicine-4237e378c70c0d6adb3dab4c9ba5cf5385f4a6ec.tar.gz medicine-4237e378c70c0d6adb3dab4c9ba5cf5385f4a6ec.zip | |
Merge branch ‘trh/files’ into trh/gets
Diffstat (limited to 'src/errors')
| -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); } }; |
