Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: exposes original axios error object #479

Merged
merged 2 commits into from
Jun 13, 2022

Conversation

nguyentoanit
Copy link
Contributor

@nguyentoanit nguyentoanit commented Jun 10, 2022

Closes #478

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2022

Codecov Report

Merging #479 (f35b134) into master (1aa6f64) will decrease coverage by 0.20%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #479      +/-   ##
==========================================
- Coverage   57.82%   57.61%   -0.21%     
==========================================
  Files          63       63              
  Lines         569      571       +2     
  Branches       30       30              
==========================================
  Hits          329      329              
- Misses        240      242       +2     
Impacted Files Coverage Δ
src/helpers/api-error-factory.ts 8.57% <0.00%> (-0.26%) ⬇️
src/types/errors/selling-partner-api-errors.ts 45.83% <0.00%> (-2.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1aa6f64...f35b134. Read the comment docs.

@nguyentoanit nguyentoanit requested a review from moltar June 10, 2022 02:48
Copy link
Contributor

@moltar moltar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it solves the issue tho?

The issue was about retaining the original error as-is. We probably just want assign it to a prop, like originalError or something like that on the thrown error object.

@nguyentoanit
Copy link
Contributor Author

I don't think it solves the issue tho?

The issue was about retaining the original error as-is. We probably just want assign it to a prop, like originalError or something like that on the thrown error object.

I assigned to cause property in our custom error classes. 👍

public cause: Error
public constructor({ modelError, headers, cause }: SellingPartnerErrorParameters) {
super(modelError.details)
this.code = modelError.code
this.message = modelError.message
this.details = modelError.details
this.requestId = headers['x-amzn-RequestId'] || headers['x-amzn-requestid'] || ''
this.cause = cause
}
}

@moltar moltar changed the title refactor: allow to access original error feat: exposes original axios error object Jun 13, 2022
@moltar moltar merged commit 134781c into master Jun 13, 2022
@moltar moltar deleted the refactor/allow-to-access-original-error branch June 13, 2022 10:43
github-actions bot pushed a commit that referenced this pull request Jun 13, 2022
# [6.4.0](v6.3.1...v6.4.0) (2022-06-13)

### Features

* exposes original axios error object ([#479](#479)) ([134781c](134781c))
@github-actions
Copy link
Contributor

🎉 This PR is included in version 6.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature-request: make error interceptor optional
3 participants