From 6f1250bc7a20285fefc01bbb4548229cb7554236 Mon Sep 17 00:00:00 2001 From: vasyl Date: Fri, 23 Feb 2024 10:20:40 +1100 Subject: [PATCH] feat: add "statusCode" to HttpError objects in addition to the existing "status" --- public/HttpError.js | 1 + test/public/graphqlUploadExpress.test.js | 1 + 2 files changed, 2 insertions(+) diff --git a/public/HttpError.js b/public/HttpError.js index f142b8e..59a26e3 100644 --- a/public/HttpError.js +++ b/public/HttpError.js @@ -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]; } diff --git a/test/public/graphqlUploadExpress.test.js b/test/public/graphqlUploadExpress.test.js index b77d2a2..c583c17 100644 --- a/test/public/graphqlUploadExpress.test.js +++ b/test/public/graphqlUploadExpress.test.js @@ -133,6 +133,7 @@ describe("graphqlUploadExpress", () => { deepStrictEqual(expressError, error); strictEqual(responseStatusCode, error.status); + strictEqual(responseStatusCode, error.statusCode); } finally { close(); }