Skip to content

Commit

Permalink
show bytes that causes error
Browse files Browse the repository at this point in the history
  • Loading branch information
aj3423 committed Apr 24, 2023
1 parent 91b1011 commit 57c99fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package aproto

import (
"encoding/binary"
"errors"
"fmt"

"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
)

// 0 Varint int32, int64, uint32, uint64, sint32, sint64, bool, enum
Expand Down Expand Up @@ -166,7 +166,7 @@ func decode_all_chunks(data []byte) ([]Chunk, error) {
for pos < uint64(len(data)) {
chunk, chunk_len, e := decode_1_chunk(data[pos:])
if e != nil {
return ret, e
return ret, errors.Wrap(e, fmt.Sprintf("chunk: %x", data[pos:]))
}
ret = append(ret, chunk)
pos += chunk_len
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.17
require (
github.com/fatih/color v1.12.0
github.com/golang/protobuf v1.5.2
github.com/pkg/errors v0.9.1
golang.org/x/text v0.3.7
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down

0 comments on commit 57c99fd

Please sign in to comment.