Skip to content

Commit

Permalink
Update error checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakkin committed Nov 8, 2019
1 parent f4e69c2 commit 09ae333
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ func streamTs(c *http.Client, ts <-chan string, out io.Writer, done chan<- error
}

_, err = io.Copy(&writerError{out}, &readerError{res.Body})
if err != nil {
if errors.Is(err, io.EOF) {
return nil
}
if err != nil && !errors.Is(err, io.EOF) {
if wErr, ok := err.(*writeError); ok {
return &fatalError{fmt.Errorf("error while writing ts to output: %w", wErr.Unwrap())}
}
if errors.Is(err, io.ErrUnexpectedEOF) {
return &skipError{fmt.Errorf("got unexpected EOF while copying ts to output")}
}

return &skipError{fmt.Errorf("couldn't copy ts to output: %w", err)}
}
Expand Down

0 comments on commit 09ae333

Please sign in to comment.