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

Add a Stream.CancelWithErr method. #12

Open
neilotoole opened this issue Dec 3, 2023 · 3 comments
Open

Add a Stream.CancelWithErr method. #12

neilotoole opened this issue Dec 3, 2023 · 3 comments

Comments

@neilotoole
Copy link

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.

@neilotoole
Copy link
Author

@djherbis ^ Any thoughts on the above?

@djherbis
Copy link
Owner

djherbis commented Dec 8, 2023

I agree the with concept, I haven't had time to review the implementation though.
Work/life have been really busy with the holiday season, I'll take a look when I can though, thanks!

@neilotoole
Copy link
Author

@djherbis Just checking in; any chance to look at the PR?

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

2 participants