Skip to content

fix: make AxiosError.message property enumerable#7392

Merged
jasonsaayman merged 4 commits intoaxios:v1.xfrom
ybbus:fix/make-message-enumerable
Feb 14, 2026
Merged

fix: make AxiosError.message property enumerable#7392
jasonsaayman merged 4 commits intoaxios:v1.xfrom
ybbus:fix/make-message-enumerable

Conversation

@ybbus
Copy link
Contributor

@ybbus ybbus commented Feb 11, 2026

Restores backward compatibility by making the message property enumerable.

In v1.13.3, the refactoring to extend native Error made message non-enumerable, breaking code that uses Object.keys(), Object.entries(), or spread operator on AxiosError instances.

This fix uses Object.defineProperty to explicitly make the message property enumerable while maintaining the benefits of extending the native Error class.

Breaking change introduced in: v1.13.3 (commit 1c6a86d)
Affects: Object.keys(), Object.entries(), spread operator, for...in loops

See: #7390


Summary by cubic

Restores backward compatibility by making AxiosError.message enumerable so Object.keys, Object.entries, spread, and for...in include it again.

Description

  • Make message enumerable via Object.defineProperty while still extending native Error.
  • Fix regression introduced in v1.13.3 that hid message from enumeration utilities.
  • Includes a build fix; no additional behavior changes.

Testing

  • Added test verifying message appears in Object.keys, Object.entries, spread, and that the property descriptor is enumerable.

Written for commit b43c9af. Summary will update on new commits.

Restores backward compatibility by making the message property
enumerable. In v1.13.3, the refactoring to extend native Error
made message non-enumerable, breaking code that uses Object.keys(),
Object.entries(), or spread operator on AxiosError instances.

This fix uses Object.defineProperty to explicitly make the message
property enumerable while maintaining the benefits of extending
the native Error class.

Breaking change introduced in: v1.13.3 (commit 1c6a86d)
Affects: Object.keys(), Object.entries(), spread operator, for...in loops
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 self-requested a review February 14, 2026 14:46
@jasonsaayman jasonsaayman added priority::high A high priority issue commit::fix The PR is related to a bugfix labels Feb 14, 2026
@jasonsaayman jasonsaayman merged commit 822e3e4 into axios:v1.x Feb 14, 2026
7 checks passed
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.

4 participants