Currently, when the channel closes and a user tries to write something the writer throws an AlreadyFinished error. This error can also be thrown when calling finish on the writer and then trying to call write again. This makes it hard to distinguish if the thrown error was due to the channel being closed or due to a business logic error in handling the writer.
Modification
This PR finishes the writer with a ChannelError.ioOnClosedChannel if the writer gets finished to due a channel inactive or handler removed.
Result
Users can now distinguish if they did something wrong with the writer or if the channel closed.
Motivation
Currently, when the channel closes and a user tries to write something the writer throws an
AlreadyFinished
error. This error can also be thrown when callingfinish
on the writer and then trying to callwrite
again. This makes it hard to distinguish if the thrown error was due to the channel being closed or due to a business logic error in handling the writer.Modification
This PR finishes the writer with a
ChannelError.ioOnClosedChannel
if the writer gets finished to due a channel inactive or handler removed.Result
Users can now distinguish if they did something wrong with the writer or if the channel closed.