Skip to content

docs(errors): clarify timeout error codes and related options#4856

Open
theamodhshetty wants to merge 2 commits intonodejs:mainfrom
theamodhshetty:codex/docs-timeout-errors-guide
Open

docs(errors): clarify timeout error codes and related options#4856
theamodhshetty wants to merge 2 commits intonodejs:mainfrom
theamodhshetty:codex/docs-timeout-errors-guide

Conversation

@theamodhshetty
Copy link
Contributor

Summary

This improves timeout-related error documentation in docs/docs/api/Errors.md.

It adds:

  • a dedicated timeout error section that maps codes to when they are thrown
  • direct links from each timeout code to the relevant configuration options (connect.timeout, headersTimeout, bodyTimeout)
  • a note clarifying that UND_ERR_SOCKET_TIMEOUT is not an Undici error code
  • a fetch-oriented example showing how to configure timeouts via setGlobalDispatcher

This is intended to make issues like UND_ERR_*_TIMEOUT easier to understand and act on, especially for users coming from fetch.

Closes #1865.

Testing

  • Documentation-only change.
  • npm run lint was attempted locally before dependencies were installed, so eslint was not available in this environment.

| `UND_ERR_BODY_TIMEOUT` | While reading the response body, no new data arrived before the body timeout elapsed. | [`bodyTimeout`](/docs/docs/api/Client.md#parameter-clientoptions) |
| `UND_ERR_SOCKET` | A generic socket-level failure happened (including some timeout-related socket errors). | Inspect `error.socket` and adjust your dispatcher/client socket settings. |

> **Note**: `UND_ERR_SOCKET_TIMEOUT` is not an Undici error code.
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest to remove this, as it can lead to ambiguity and misunderstanding; rather let's just list the codes we support so any code outside of the list can be understood as non supported or non originated from undici

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I removed that note in 379617c so the section only documents the supported Undici error codes and does not speculate about unsupported ones.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.15%. Comparing base (0bf0a2a) to head (379617c).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4856   +/-   ##
=======================================
  Coverage   93.14%   93.15%           
=======================================
  Files         109      109           
  Lines       34239    34254   +15     
=======================================
+ Hits        31893    31910   +17     
+ Misses       2346     2344    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

UND_ERR_***_TIMEOUT explanation

3 participants