diff --git a/chan_io.go b/chan_io.go index 3c9d41c..c3e048e 100644 --- a/chan_io.go +++ b/chan_io.go @@ -23,6 +23,10 @@ func WriteIntoDelayed[T any](ch chan<- T, delay time.Duration, values ...T) { func WriteIntoWriter[T any](ch <-chan T, writers ...io.Writer) { w := io.MultiWriter(writers...) EachSuccessive(ch, func(value T) { + if err, ok := any(value).(error); ok { + fmt.Fprintln(w, err.Error()) + return + } fmt.Fprintln(w, value) }) }