Skip to content

Conversation

Acconut
Copy link
Member

@Acconut Acconut commented Jun 13, 2025

While working on #775, we discovered that not every HTTP stack in tus-js-client behaves the same way when aborting requests:

  • XHRHttpStack just leaves the promise returned by send hanging, neither resolving nor rejecting it.
  • NodeHttpStack threw a network-related error (usually ECONNRESET).
  • FetchHttpStack threw a DOMException.

While the exact error is not important, it's helpful to standardize on throwing some error, as allows for simpler logic when aborting requests. Hence this PR, which implements this. It uses a DOMException since normal Error instances in JavaScript don't have proper error codes. While DOMException is a Web API, I think it's available in most JavaScript runtimes.

@m7kvqbe1
Copy link

LGTM

@Acconut Acconut merged commit 7cc02f2 into main Jun 30, 2025
8 of 10 checks passed
@Acconut Acconut deleted the aborterror branch June 30, 2025 07:32
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.

2 participants