Skip to content

fix: abort timed-out requests with TimeoutError - #4045

Open
manwithacat wants to merge 1 commit into
bigskysoftware:four-devfrom
manwithacat:fix/timeout-error-reason
Open

fix: abort timed-out requests with TimeoutError#4045
manwithacat wants to merge 1 commit into
bigskysoftware:four-devfrom
manwithacat:fix/timeout-error-reason

Conversation

@manwithacat

@manwithacat manwithacat commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Request timeouts called AbortController.abort() with no reason, so a timeout and an hx-sync replace were both AbortError. Pass TimeoutError ("Request timed out") as the abort reason so apps can tell them apart via ctx.request.signal.reason.

Corresponding issue: #4021

Demo: https://manwithacat.github.io/htmx/demos/timeout-error-reason/

Testing

Existing timeout test now asserts signal.reason.name === 'TimeoutError'. Added a replace-abort case that is not TimeoutError. Documented the discriminator on htmx:error.

Local npm test (Chromium, same as CI htmx_tests): 87 files, 1739 passed, 0 failed, 5 skipped.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against four-dev
  • This is a bugfix
  • Full browser suite — CI; __issueRequest unit tests cover timeout vs replace

Timeouts called AbortController.abort() with no reason, so hx-sync
replace and request timeout were indistinguishable AbortErrors.
Pass TimeoutError as the abort reason.

Closes bigskysoftware#4021
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.

1 participant