mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
Merge pull request #832 from jbenet/fix/831
more understandable errors from merkledag decoding
This commit is contained in:
@ -92,7 +92,10 @@ func (n *Node) Encoded(force bool) ([]byte, error) {
|
||||
|
||||
// Decoded decodes raw data and returns a new Node instance.
|
||||
func Decoded(encoded []byte) (*Node, error) {
|
||||
n := &Node{}
|
||||
n := new(Node)
|
||||
err := n.Unmarshal(encoded)
|
||||
return n, err
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("incorrectly formatted merkledag node: %s", err)
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user