Skip to content

Commit

Permalink
Update ups.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrutcher committed May 19, 2023
1 parent 9bd5b32 commit 8da96fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions carriers/ups.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ function UPS(options) {
}

if (body && !body.TrackResponse) {
if (body.Fault && body.Fault.detail && body.Fault.detail.Errors && body.Fault.detail.Errors.ErrorDetail && body.Fault.detail.Errors.ErrorDetail.PrimaryErrorCode && body.Fault.detail.Errors.ErrorDetail.PrimaryErrorCode.Description) {
if (body?.Fault?.detail?.Errors?.ErrorDetail?.PrimaryErrorCode?.Description) {
return callback(new Error(body.Fault.detail.Errors.ErrorDetail.PrimaryErrorCode.Description));
} else {
return callback(new Error('Invalid or missing TrackResponse'));
}
}

if (body && body.TrackResponse && body.TrackResponse.Response && body.TrackResponse.Response.Error) {
if (body?.TrackResponse?.Response?.Error) {
return callback(new Error(body.TrackResponse.Response.Error.ErrorDescription))
}

Expand Down

0 comments on commit 8da96fb

Please sign in to comment.