feat: add ECONNREFUSED error code constant to AxiosError (closes #6485)#10680
Merged
jasonsaayman merged 2 commits intoaxios:v1.xfrom Apr 25, 2026
Merged
Conversation
Adds `AxiosError.ECONNREFUSED` as a typed constant alongside existing error codes like ECONNABORTED and ETIMEDOUT, enabling type-safe error code checks without hardcoding strings. Closes axios#6485
jasonsaayman
approved these changes
Apr 25, 2026
ModyQyW
added a commit
to uni-helper/uni-network
that referenced
this pull request
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AxiosError.ECONNREFUSED = 'ECONNREFUSED'as a typed constantlib/core/AxiosError.js,index.d.ts,index.d.ctsContext
Issue #6485 requested the ability to use
ECONNREFUSEDas a typed constant onAxiosError, similar to existing codes likeECONNABORTEDandETIMEDOUT. Currently users must hardcode the string"ECONNREFUSED".Test plan
AxiosError.ECONNREFUSEDresolves to'ECONNREFUSED'at runtimeECONNREFUSEDon theAxiosErrorclassSummary by cubic
Adds
AxiosError.ECONNREFUSEDas a typed constant for type-safe error checks and better IDE autocomplete. Synced withv1.xwith no functional changes.Description
ECONNREFUSEDtoAxiosErrorinlib/core/AxiosError.jsindex.d.tsandindex.d.ctsto expose the new static constantv1.xinto this branch (no additional changes)ECONNABORTEDandETIMEDOUTDocs
ECONNREFUSEDto the list of availableAxiosErrorcodesAxiosError.ECONNREFUSEDin error handlingTesting
AxiosError.ECONNREFUSED === 'ECONNREFUSED'AxiosError.ECONNREFUSEDtyped as'ECONNREFUSED'Semantic version impact
AxiosErrorWritten for commit 644ab15. Summary will update on new commits.