Skip to content

Commit

Permalink
Improve http error handling on error conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Dec 13, 2023
1 parent 7297677 commit f247d71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 7 additions & 5 deletions src/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit f247d71

Please sign in to comment.