1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-26 02:45:48 +08:00

better error message from dagreader with bad protofbuf

This commit is contained in:
Jeromy
2015-03-07 19:08:39 -08:00
parent 63e15abd8f
commit 9832545d84

View File

@ -3,6 +3,7 @@ package io
import ( import (
"bytes" "bytes"
"errors" "errors"
"fmt"
"io" "io"
"os" "os"
@ -113,7 +114,7 @@ func (dr *DagReader) precalcNextBuf() error {
pb := new(ftpb.Data) pb := new(ftpb.Data)
err = proto.Unmarshal(nxt.Data, pb) err = proto.Unmarshal(nxt.Data, pb)
if err != nil { if err != nil {
return err return fmt.Errorf("incorrectly formatted protobuf: %s", err)
} }
switch pb.GetType() { switch pb.GetType() {