services/tree: Make error humane

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-06-26 11:38:23 +03:00
parent 20daa7d9dc
commit 851e410b83

View file

@ -20,6 +20,9 @@ func (s *Service) BurnedAdd(ctx context.Context, req *BurnedAddRequest) (*Burned
if err != nil {
return nil, err
}
if pos < 0 {
return nil, errors.New("the node is not in the container")
}
d := pilorama.CIDDescriptor{CID: cid, Position: pos, Size: len(ns)}
meta := protoToMeta(b.GetMeta())
@ -54,6 +57,9 @@ func (s *Service) BurnedRemove(ctx context.Context, req *BurnedRemoveRequest) (*
if err != nil {
return nil, err
}
if pos < 0 {
return nil, errors.New("the node is not in the container")
}
d := pilorama.CIDDescriptor{CID: cid, Position: pos, Size: len(ns)}
key := b.GetKey()