Skip to content

docs: clarify async/await timeout error handling#7471

Merged
jasonsaayman merged 3 commits into
axios:v1.xfrom
nthbotast:docs/timeout-async-await-example
Apr 5, 2026
Merged

docs: clarify async/await timeout error handling#7471
jasonsaayman merged 3 commits into
axios:v1.xfrom
nthbotast:docs/timeout-async-await-example

Conversation

@nthbotast
Copy link
Copy Markdown
Contributor

@nthbotast nthbotast commented Mar 3, 2026

Summary

  • expand the timeout async/await snippet to handle both ECONNABORTED and ETIMEDOUT
  • show where transitional.clarifyTimeoutError affects the timeout code
  • keep a clear fallback branch for non-timeout and unexpected errors

Fixes #7225

Testing

  • not run locally (docs-only change; local npm run test:eslint requires cross-env in this clone)

Summary by cubic

Clarifies the async/await timeout example in the README. Handles both timeout codes and shows how transitional.clarifyTimeoutError changes the error code.

Description

  • Handle ECONNABORTED and ETIMEDOUT in one timeout branch with an early return.
  • Add transitional.clarifyTimeoutError in the request config (example defaults to false; set true for ETIMEDOUT).
  • Separate axios errors from unexpected errors with clearer logging.

Docs

  • Updated README.md example and added an inline comment explaining clarifyTimeoutError.

Testing

  • Docs-only change; no tests modified.
  • No tests needed.

Written for commit 734c4ad. Summary will update on new commits.

Copy link
Copy Markdown
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 1 file

Confidence score: 5/5

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

@jasonsaayman jasonsaayman added priority::low A low priority issue commit::docs The PR is related to docs labels Apr 5, 2026
@jasonsaayman jasonsaayman merged commit 173efa3 into axios:v1.x Apr 5, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::docs The PR is related to docs priority::low A low priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing example for handling request timeouts in async/await syntax

2 participants