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

Include request and config when creating a CanceledError. #4659

Merged
merged 6 commits into from May 3, 2022
Merged

Include request and config when creating a CanceledError. #4659

merged 6 commits into from May 3, 2022

Conversation

arthurfiorette
Copy link
Contributor

Currently, only the error thrown by a canceled request does not maintain any data connection with its original request. This way, it's basically impossible to trace back which request was canceled based on just the error thrown.

This PR only enables all available parameters to the AxiosError instance: config and request.

function AxiosError(message, code, config, request, response) {

This way, any following CanceledError thrown will have the request and request config available.

@arthurfiorette arthurfiorette changed the title Include request config when creating a CanceledError. Include request and config when creating a CanceledError. May 1, 2022
@arthurfiorette
Copy link
Contributor Author

Specifically, this enables axios-cache-interceptor to remove the original loading cache state when a request is canceled. Because with the current error, it cannot find what request it was.

@jasonsaayman
Copy link
Member

Thanks for the PR looks great :)

@jasonsaayman jasonsaayman merged commit ff1e5cd into axios:master May 3, 2022
@arthurfiorette arthurfiorette deleted the include-config-axios-abort branch May 3, 2022 18:34
@arthurfiorette
Copy link
Contributor Author

Hey @jasonsaayman, sorry to bother you, but can you at least make a patch release with this fix soon?

@jasonsaayman
Copy link
Member

Cool I will try get the small changes cherry picked

@arthurfiorette
Copy link
Contributor Author

arthurfiorette commented Aug 18, 2022

Hey @jasonsaayman, sorry to bother you again...

Can this fix be released into a new v0 patch? It is leading to many bugs when integrating with onReject interceptors...

See arthurfiorette/axios-cache-interceptor/issues/317.

If you could just cherry pick this PR (and #4711 & #4922 [they are related]) to v0.27.3 would be awesome!!!

Thanks.

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

Successfully merging this pull request may close these issues.

None yet

3 participants