Skip to content

From the perspective of the top-level API, abort() errors behave inconsistently #54

@MattiasMartens

Description

@MattiasMartens

Imported from #47

In the case where abort() is not caught inside a utility function, an error passed to abort() has to be handled at the source, or it will bubble up as an unhandled rejection. An unhandled rejection generally signals to the developer that they've done something quite wrong (Node will of course scold you severely for doing this!). And according to the Stream idiom, they have.

In the case where abort() is caught inside a utility function (to pass it downstream), an error passed to abort() won't bubble upstream to the source, even though the "handling" that's taking place is trivial and not actually doing anything. In this case, an abort() error will simply be swallowed, and the developer won't see it so they won't be under the impression that they've handled anything incorrectly.

Technically, they really haven't, because swallowing an abort error is a valid response to it. But it is a surprising experience for the developer. It's one thing to have an error bubble up and not understand why—then at least there's something to understand. It's another to have an error get swallowed by the internal implementation before the developer can even learn about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions