From 41b3d219b683075eac3f4f53d42243af4decc312 Mon Sep 17 00:00:00 2001 From: Greg Byrne <5464272+byrne-greg@users.noreply.github.com> Date: Sun, 5 Sep 2021 12:45:24 +0100 Subject: [PATCH] Adding HTTP status code to error.toJSON (#2956) * Adding HTTP status code to error.toJSON (axios#2947) * Adding Error display div to internal server client.html Co-authored-by: Jay --- lib/core/enhanceError.js | 3 ++- sandbox/client.html | 10 +++++++++- test/specs/core/createError.spec.js | 1 + test/specs/core/enhanceError.spec.js | 12 +++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/core/enhanceError.js b/lib/core/enhanceError.js index b6bc4444e1..db04ec8ea0 100644 --- a/lib/core/enhanceError.js +++ b/lib/core/enhanceError.js @@ -35,7 +35,8 @@ module.exports = function enhanceError(error, config, code, request, response) { stack: this.stack, // Axios config: this.config, - code: this.code + code: this.code, + status: this.response && this.response.status ? this.response.status : null }; }; return error; diff --git a/sandbox/client.html b/sandbox/client.html index 55051c2ea0..c06ae16940 100644 --- a/sandbox/client.html +++ b/sandbox/client.html @@ -5,7 +5,6 @@