Skip to content

Internal promises that can be rejected need to be handled #468

@jplaisted

Description

@jplaisted

Title is a general rule of thumb but there's only one violation that I've found so far, and its in the reference implementation of pipeTo. The promises returned from dest.write are not catch'd and are never exposed to any consumers for them to catch either. So if there's an error with dest and there are pending writes from a pipe there will be uncaught Javascript exceptions and nothing the consumer can reasonably do to handle them. Possible solution is to pass a blank function to a catch of write, or rethrowAssertionErrorRejection.

There's also an issue with consumers/producers having to handle the exceptions from read()/write() and also the closed promise. They must handle both even though they'll be the same error. pipeTo is an example of this where any [non-assertion] errors from read() are just swallowed because they're handled in close. I'm not sure if this can be cleaned up, I can see some consumers wanting the closed promise and others wanting the promises from read/write, but I figured I'd point out the forced redundancy anyways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions