Commit 29695e9e authored by Mildred Ki'Lya's avatar Mildred Ki'Lya Committed by Shanti Bouchez-Mongardé

Improve error reporting and fix pin/set_test.go

License: MIT
Signed-off-by: default avatarMildred Ki'Lya <mildred-pub.git@mildred.fr>
parent cbc9a085
......@@ -27,7 +27,7 @@ func (n *Node) unmarshal(encoded []byte) error {
n.Links[i] = &Link{Name: l.GetName(), Size: l.GetTsize()}
h, err := mh.Cast(l.GetHash())
if err != nil {
return fmt.Errorf("Link hash is not valid multihash. %v", err)
return fmt.Errorf("Link hash #%d is not valid multihash. %v", i, err)
}
n.Links[i].Hash = h
}
......
......@@ -79,10 +79,14 @@ func (n *dagService) Get(ctx context.Context, k key.Key) (*Node, error) {
if err == bserv.ErrNotFound {
return nil, ErrNotFound
}
return nil, err
return nil, fmt.Errorf("Failed to get block for %s: %v", k.B58String(), err)
}
return DecodeProtobuf(b.Data)
res, err := DecodeProtobuf(b.Data)
if err != nil {
return nil, fmt.Errorf("Failed to decode Protocol Buffers: %v", err)
}
return res, nil
}
func (n *dagService) Remove(nd *Node) error {
......
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