Re: [whatwg/dom] Add a way to identify Abort errors originating from controllers (Issue #1033)

> I also don't see it as breaking in the general case. Node.js has, for some time, used our own AbortError instance to signal cancelations, and it will be breaking for Node.js users if/when we start switching those specific cases to use signal.reason or DOMException(AbortErr), but that's a Node.js-specific implementation detail. We'd just need to walk changes there through a proper deprecation cycle.

I am not sure Node.js will align (there will be significant resistance internally), remember: I am not the one who pushed Node's own AbortError and those parties will have to be convinced or we will have to end up with a non-spec-compliant signal. Our consensus based governance is that blocking is very easy and the TSC doesn't like calling shots when there is resistence.

That said: I believe we can handle Node.js - I was more concerned with everyone on the web using `fetch` though (rather than people in Node.js) - these people are expecting `AbortError`s to mean the signal was aborted and cancellation otherwise.

I am honestly kind of terrified by this change and don't have the capacity to "dig into" this since I'm stuck home with a sick kid who won't let me get more than 10+ of computer time :) Once I get more time I'll probably spend it on symbols in signals since that will teach me more about WebIDL and there appears to be consensus.


--------

That said, to avoid the breaking change I think would make sense to:
 - Add a base `ExceptionController` type and `ExceptionSignal`.
 - That can signal any sort of exception.
 - Make `AbortSignal` a subtype of `ExceptionSignal` (and AbortController of ExceptionController).
 - AbortSignal/AbortController can only raise DOMExceptions of certain types (or even just AbortError) and treat `.reason` as metadata.
 - Make `fetch` and other DOM APIs use `ExceptionController`, people would still be able to pass in `AbortController`.

That way we fix the problematic terminology, end up with a clearer API and a smaller one with better API guarantees. Then Node.js can choose which APIs get ExceptionController and which do not.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1033#issuecomment-979853652

Received on Friday, 26 November 2021 10:20:06 UTC