aboutsummaryrefslogtreecommitdiff
path: root/src/errors
diff options
context:
space:
mode:
authorTom Harley2018-03-29 08:32:54 +0100
committerTom Harley2018-03-29 08:32:54 +0100
commit8f39a1403d3c94f3d51693e41843750352408cba (patch)
tree4833fd458e1d8590d798b8d1ede14bfb487aadea /src/errors
parentMerge branch 'testing-middleware' into development (diff)
downloadmedicine-8f39a1403d3c94f3d51693e41843750352408cba.tar.gz
medicine-8f39a1403d3c94f3d51693e41843750352408cba.zip

Address numerous errors in test suites

Many errors still remian.

Diffstat (limited to 'src/errors')
-rw-r--r--src/errors/errorware.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/errors/errorware.ts b/src/errors/errorware.ts
index 05c714d..6d87bcb 100644
--- a/src/errors/errorware.ts
+++ b/src/errors/errorware.ts
@@ -28,7 +28,7 @@ export class RequestError extends Error {
* @returns `true` if the object is a [[RequestError]]; `false`
* otherwise.
*/
- public static is(test: Object): test is RequestError {
+ public static is(test: object): test is RequestError {
return (test as Partial<RequestError>).code !== undefined
&& (test as Partial<RequestError>).name !== undefined
&& (test as Partial<RequestError>).responseBlock !== undefined;
@@ -110,9 +110,11 @@ export type Errorware =
* @param err The Error to act on.
* @param req The Express http request.
* @param res The Express http response.
+ * @param next The next Express middleware function.
*/
-export const errorHandler: Errorware =
- (err: Error, req: Request, res: Response): void => {
+export const errorHandler: Errorware = (
+ err: Error, req: Request, res: Response, next: NextFunction
+): void => {
if (RequestError.is(err)) {
res.status(err.code)
.json(err.responseBlock());