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
|
package h265
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -248,8 +247,8 @@ func TestLex(t *testing.T) {
|
||||||
r := &rtpReader{packets: test.packets}
|
r := &rtpReader{packets: test.packets}
|
||||||
d := &destination{}
|
d := &destination{}
|
||||||
err := NewLexer(test.donl).Lex(d, r, 0)
|
err := NewLexer(test.donl).Lex(d, r, 0)
|
||||||
switch {
|
switch err {
|
||||||
case err == nil || errors.Is(err, io.EOF): // Do nothing
|
case nil, io.EOF: // Do nothing
|
||||||
default:
|
default:
|
||||||
t.Fatalf("error lexing: %v\n", err)
|
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) {
|
func (r *Revid) processFrom(read io.Reader, delay time.Duration) {
|
||||||
err := r.lexTo(r.filters[0], read, delay)
|
err := r.lexTo(r.filters[0], read, delay)
|
||||||
r.cfg.Logger.Log(logger.Debug, pkg+"finished lexing")
|
r.cfg.Logger.Log(logger.Debug, pkg+"finished lexing")
|
||||||
switch {
|
switch err {
|
||||||
case err == nil: // Do nothing.
|
case nil: // Do nothing.
|
||||||
case errors.Is(err, io.EOF): // TODO: handle this depending on loop mode.
|
case io.EOF: // TODO: handle this depending on loop mode.
|
||||||
default:
|
default:
|
||||||
r.err <- err
|
r.err <- err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue