Skip to content

fix(core): copy status from source error in AxiosError.from#7403

Merged
jasonsaayman merged 2 commits intoaxios:v1.xfrom
skrtheboss:fix/7364-preserve-error-status
Feb 18, 2026
Merged

fix(core): copy status from source error in AxiosError.from#7403
jasonsaayman merged 2 commits intoaxios:v1.xfrom
skrtheboss:fix/7364-preserve-error-status

Conversation

@skrtheboss
Copy link
Contributor

@skrtheboss skrtheboss commented Feb 17, 2026

This pull request enhances the handling of the status property in AxiosError instances, ensuring that error status codes are preserved or correctly overridden depending on the context. Unit tests have been added to verify these behaviors.

Improvements to error handling:

  • Updated AxiosError.from to preserve the status property from the original error if no response is provided, and to use response.status when a response is present. (lib/core/AxiosError.js)

Testing enhancements:

  • Added unit tests to verify that AxiosError correctly preserves the original error's status when no response is provided, and prefers response.status when a response is present. (test/specs/core/AxiosError.spec.js)

#7364

When creating an AxiosError from an existing error without a response object,
the status property from the source error is now preserved. This ensures error
status information is not lost during error conversion.

Fixes axios#7364
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@jasonsaayman jasonsaayman added priority::high A high priority issue commit::fix The PR is related to a bugfix labels Feb 18, 2026
@jasonsaayman jasonsaayman merged commit d51accb into axios:v1.x Feb 18, 2026
6 checks passed
@skrtheboss skrtheboss deleted the fix/7364-preserve-error-status branch February 24, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::high A high priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants