Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aborted requests should be rejected with AbortSignal.reason #1360

Open
u873838 opened this issue Aug 1, 2024 · 0 comments
Open

Aborted requests should be rejected with AbortSignal.reason #1360

u873838 opened this issue Aug 1, 2024 · 0 comments

Comments

@u873838
Copy link

u873838 commented Aug 1, 2024

The current behavior of aborted request cause the promise to reject with a simple Error. e.g.:

const abortError = new Error("Request aborted");
abortError.name = "AbortError";
reject(abortError);

const abortError = new Error("Request aborted");
abortError.name = "AbortError";
reject(abortError);

This makes error handling more difficult, as the caller does not know which AbortSignal e.g. when used with AbortSignal.any caused the request to be aborted.

I recommend changing the code to reject with AbortSignal.reason when an AbortSignal is aborted (at least for native AbortSignal implementations).

@u873838 u873838 changed the title Aborted requests should be rejected with with AbortSignal.reason Aborted requests should be rejected with AbortSignal.reason Aug 1, 2024
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

No branches or pull requests

1 participant