fix: check errors by string
Unfortunately, we return errors over the HTTP API and lose the type. This commit was moved from ipfs/interface-go-ipfs-core@98e72571bc4514239cbe7bba4321ab5da4194366 This commit was moved from ipfs/boxo@b722930c08cda76a887769564a94055f41268c38
Steven Allen committed
Aug 17, 2021 at 13:10 UTC
f909368aa097438d3ae19dc4c8f3b0512b79e540
1 file changed
+1
-3
core/coreiface/tests/path.go
+1
-3
@@ -2,12 +2,10 @@ package tests
2
3
import (
4
"context"
5
- "errors"
5
"math"
6
"strings"
7
"testing"
8
10
- "github.com/ipfs/go-path/resolver"
9
"github.com/ipfs/interface-go-ipfs-core/path"
10
11
"github.com/ipfs/interface-go-ipfs-core/options"
@@ -141,7 +139,7 @@ func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) {
139
}
140
141
_, err = api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/bar/baz"))
144
- if err == nil || !errors.As(err, &resolver.ErrNoLink{}) {
142
+ if err == nil || !strings.Contains(err.Error(), `no link named "bar"`) {
143
t.Fatalf("unexpected error: %s", err)
144
}
145
}