Skip to content

Add a Stream.CancelWithErr method. #12

@neilotoole

Description

@neilotoole

We already have a Stream.ShutdownWithErr mechanism, which propagates a custom error.

There's also a Stream.Cancel method. However, there should be a Stream.CancelWithErr method to allow propagation of a custom error.

For example, let's say I'm reading from an http response, and writing the bytes to a stream. If there's an error reading the response, I specifically want to Cancel the stream (as opposed to calling Shutdown). But, any clients of the stream will just receive a generic ErrCanceled, which is not super helpful. I want to be able to propagate the http error back to the stream clients.

Possible implementation in PR #11.

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