Commit 7e655ddf authored by Jeromy's avatar Jeromy

more understandable errors from merkledag decoding

parent c0fdcddd
......@@ -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
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment