Skip to content

Commit

Permalink
feat: add "statusCode" to HttpError objects in addition to the existi…
Browse files Browse the repository at this point in the history
…ng "status"
  • Loading branch information
koresar committed Feb 22, 2024
1 parent d422f55 commit 6f1250b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/HttpError.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = class HttpError extends Error {
constructor(status, message) {
super(message);
this.status = status;
this.statusCode = status;
this.expose = true;
this.name = errorNames[status];
}
Expand Down
1 change: 1 addition & 0 deletions test/public/graphqlUploadExpress.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ describe("graphqlUploadExpress", () => {

deepStrictEqual(expressError, error);
strictEqual(responseStatusCode, error.status);
strictEqual(responseStatusCode, error.statusCode);
} finally {
close();
}
Expand Down

0 comments on commit 6f1250b

Please sign in to comment.