Skip to content

Commit

Permalink
fix: remove error chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Wkkkkk committed Jan 24, 2024
1 parent 001a17a commit 86fb148
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
require (
github.com/asticode/go-astikit v0.42.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/g8rswimmer/error-chain v1.0.0 // indirect
github.com/go-test/deep v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ github.com/asticode/go-astits v1.13.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/g8rswimmer/error-chain v1.0.0 h1:WnwnunlvqtGPHVHmBfbmUyAgrtag8Y6nNpwLWmtSYOQ=
github.com/g8rswimmer/error-chain v1.0.0/go.mod h1:XPJ/brUsL7yzc5VRlIxtf9GvoUqnOKVI9fg2MB5DWx8=
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
Expand Down
17 changes: 8 additions & 9 deletions internal/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/Comcast/gots/v2/psi"
"github.com/Comcast/gots/v2/scte35"
"github.com/asticode/go-astits"
chain "github.com/g8rswimmer/error-chain"
)

func ParseAll(ctx context.Context, w io.Writer, f io.Reader, o Options) error {
Expand Down Expand Up @@ -256,22 +255,22 @@ func ParseSCTE35(ctx context.Context, w io.Writer, f io.Reader, o Options) error
func ParseInfoAndSCTE35(ctx context.Context, w io.Writer, f io.Reader, o Options) error {
var out1, out2 bytes.Buffer
_, err := CopyToAll(f, &out1, &out2)
ec := chain.New()
if err != nil {
ec.Add(errors.New("failed to copy input"))
return errors.New("failed to copy input stream")
}

f1 := strings.NewReader(out1.String())
infoErr := ParseInfo(ctx, w, f1, o)
if infoErr != nil {
return infoErr
}

f2 := strings.NewReader(out2.String())
scteErr := ParseSCTE35(ctx, w, f2, o)
if infoErr == nil && scteErr == nil {
return nil
if scteErr != nil {
return scteErr
}

ec.Add(infoErr)
ec.Add(scteErr)
return ec
return nil
}

func CopyToAll(rd io.Reader, wrs ...io.Writer) (int64, error) {
Expand Down

0 comments on commit 86fb148

Please sign in to comment.