diff --git a/CHANGELOG.md b/CHANGELOG.md index cd35d46..947ffc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ This is the changelog for [Authress Login](readme.md). ## 2.3 ## * Add MFA device methods. +* Improve http error handling when there is an issue authenticating. ## 2.2 ## * Automatically retry on network connection issues. diff --git a/src/httpClient.js b/src/httpClient.js index 65fee8a..e60757f 100644 --- a/src/httpClient.js +++ b/src/httpClient.js @@ -128,11 +128,13 @@ class HttpClient { this.logger[level]({ title: message, online: navigator.onLine, method, url, status, data, headers, error, resolvedError }); } - error.url = url; - error.status = status; - error.data = resolvedError; - error.headers = error.response.headers || error.headers; - throw error; + const httpError = { + url: url, + status: status, + data: resolvedError, + headers: error.response.headers || error.headers + }; + throw httpError; } } }