Skip to content
This repository was archived by the owner on Jun 16, 2022. It is now read-only.

Commit c01bfe8

Browse files
committed
throw errors sent to next by default
1 parent 2c47a7a commit c01bfe8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fake-express-http.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ class FakeExpressHttp {
44
constructor() {
55
this.request = new FakeHttpRequest();
66
this.response = new FakeHttpResponse();
7-
this.next = () => {
7+
this.next = (error) => {
88
/* istanbul ignore next */
9-
throw new Error(`unexpected call to next with ${JSON.stringify(arguments)}`);
9+
if (error instanceof Error) {
10+
throw error;
11+
} else {
12+
throw new Error(`unexpected call to next with ${JSON.stringify(arguments)}`);
13+
}
1014
};
1115
}
1216
}

0 commit comments

Comments
 (0)