mirror of https://bitbucket.org/ausocean/av.git
fixed handling of errors from lex methods
This commit is contained in:
parent
78484b5f5b
commit
9b8667e56c
|
@ -28,7 +28,6 @@ LICENSE
|
|||
package h265
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"testing"
|
||||
)
|
||||
|
@ -248,8 +247,8 @@ func TestLex(t *testing.T) {
|
|||
r := &rtpReader{packets: test.packets}
|
||||
d := &destination{}
|
||||
err := NewLexer(test.donl).Lex(d, r, 0)
|
||||
switch {
|
||||
case err == nil || errors.Is(err, io.EOF): // Do nothing
|
||||
switch err {
|
||||
case nil, io.EOF: // Do nothing
|
||||
default:
|
||||
t.Fatalf("error lexing: %v\n", err)
|
||||
}
|
||||
|
|
|
@ -849,9 +849,9 @@ func (r *Revid) Update(vars map[string]string) error {
|
|||
func (r *Revid) processFrom(read io.Reader, delay time.Duration) {
|
||||
err := r.lexTo(r.filters[0], read, delay)
|
||||
r.cfg.Logger.Log(logger.Debug, pkg+"finished lexing")
|
||||
switch {
|
||||
case err == nil: // Do nothing.
|
||||
case errors.Is(err, io.EOF): // TODO: handle this depending on loop mode.
|
||||
switch err {
|
||||
case nil: // Do nothing.
|
||||
case io.EOF: // TODO: handle this depending on loop mode.
|
||||
default:
|
||||
r.err <- err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue