File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ func (se SerializationError) Unwrap() error {
66
66
return se .err
67
67
}
68
68
69
+ func (se SerializationError ) Is (o error ) bool {
70
+ _ , ok := o .(* SerializationError )
71
+ return ok
72
+ }
73
+
69
74
type blocks interface {
70
75
GetBlock (context.Context , cid.Cid ) (block.Block , error )
71
76
AddBlock (block.Block ) error
Original file line number Diff line number Diff line change @@ -3,9 +3,11 @@ package hamt
3
3
import (
4
4
"bytes"
5
5
"context"
6
+ "fmt"
6
7
"testing"
7
8
8
9
cbg "github.com/whyrusleeping/cbor-gen"
10
+ xerrors "golang.org/x/xerrors"
9
11
10
12
cbor "github.com/ipfs/go-ipld-cbor"
11
13
)
@@ -58,3 +60,11 @@ func TestBasicBytesLoading(t *testing.T) {
58
60
t .Fatal ("bytes round trip failed" )
59
61
}
60
62
}
63
+
64
+ func TestIsSerializationError (t * testing.T ) {
65
+ serr := NewSerializationError (fmt .Errorf ("i am a cat" ))
66
+
67
+ if ! xerrors .Is (serr , & SerializationError {}) {
68
+ t .Fatal ("its not a serialization error?" )
69
+ }
70
+ }
You can’t perform that action at this time.
0 commit comments