From d6243eb7afd5d9d91686bce2e02c252be456b38c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2022 02:41:14 -0600 Subject: better errors --- pkg/btrfs/btrfsitem/item_chunk.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg/btrfs/btrfsitem') diff --git a/pkg/btrfs/btrfsitem/item_chunk.go b/pkg/btrfs/btrfsitem/item_chunk.go index 17f069c..5c573b0 100644 --- a/pkg/btrfs/btrfsitem/item_chunk.go +++ b/pkg/btrfs/btrfsitem/item_chunk.go @@ -38,7 +38,7 @@ func (chunk *Chunk) UnmarshalBinary(dat []byte) (int, error) { _n, err := binstruct.Unmarshal(dat[n:], &stripe) n += _n if err != nil { - return n, err + return n, fmt.Errorf("%T.UnmarshalBinary: %w", *chunk, err) } chunk.Stripes = append(chunk.Stripes, stripe) } @@ -55,7 +55,7 @@ func (chunk Chunk) MarshalBinary() ([]byte, error) { _ret, err := binstruct.Marshal(stripe) ret = append(ret, _ret...) if err != nil { - return ret, err + return ret, fmt.Errorf("%T.MarshalBinary: %w", chunk, err) } } return ret, nil -- cgit v1.2.3-54-g00ecf