Skip to content

Commit

Permalink
fix: use consistent fields between success and error response objects (
Browse files Browse the repository at this point in the history
…#78)

* add fields `status` and `statusText` to error responses to match success responses
  • Loading branch information
dpopp07 authored Jan 30, 2020
1 parent 0a5b2df commit 902d712
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/request-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,12 @@ export class RequestWrapper {
delete axiosError.config;
delete axiosError.request;

error.name = axiosError.statusText;
error.code = axiosError.status;
error.statusText = axiosError.statusText;
error.name = axiosError.statusText; // ** deprecated **

error.status = axiosError.status;
error.code = axiosError.status; // ** deprecated **

error.message = parseServiceErrorMessage(axiosError.data) || axiosError.statusText;

// some services bury the useful error message within 'data'
Expand Down

0 comments on commit 902d712

Please sign in to comment.