diff --git a/peer/server.go b/peer/server.go index 23ea7eb..cc10e0f 100644 --- a/peer/server.go +++ b/peer/server.go @@ -2,7 +2,9 @@ package peer import ( "bufio" + "encoding/hex" "encoding/json" + ee "errors" "io" "net" "strings" @@ -220,6 +222,10 @@ func (s *Server) handleCompositeRequest(data []byte) ([]byte, error) { var request compositeRequest err := json.Unmarshal(data, &request) if err != nil { + var je json.SyntaxError + if ee.As(err, &je) { + return nil, errors.Err("invalid json at offset %d in data %s", je.Offset, hex.EncodeToString(data)) + } return nil, errors.Err(err) }