diff --git a/codec/mjpeg/lex.go b/codec/mjpeg/lex.go index 46ab4ce8..d8b671b2 100644 --- a/codec/mjpeg/lex.go +++ b/codec/mjpeg/lex.go @@ -63,10 +63,7 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { return nil } if err != nil { - if err == io.EOF { - return nil - } - return err + return fmt.Errorf("can't read source: %w", err) } if !bytes.Equal(buf, []byte{0xff, 0xd8}) { return fmt.Errorf("parser: not MJPEG frame start: %#v", buf) @@ -75,10 +72,7 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { for { b, err := r.ReadByte() if err != nil { - if err == io.EOF { - return nil - } - return err + return fmt.Errorf("can't read byte: %w", err) } buf = append(buf, b) if last == 0xff && b == 0xd9 {