mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-03 07:18:12 +08:00
return a better error if the ref is not an object
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
parent
7d18f74879
commit
e8fcd19969
@ -3,6 +3,7 @@ package merkledag
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
blocks "github.com/ipfs/go-ipfs/blocks"
|
||||
@ -87,6 +88,9 @@ func (n *dagService) Get(ctx context.Context, k key.Key) (*Node, error) {
|
||||
|
||||
res, err := DecodeProtobuf(b.Data())
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "Unmarshal failed") {
|
||||
return nil, fmt.Errorf("%s was not a valid merkledag node", k)
|
||||
}
|
||||
return nil, fmt.Errorf("Failed to decode Protocol Buffers: %v", err)
|
||||
}
|
||||
return res, nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user