Skip to content

Commit

Permalink
fix: check errors by string
Browse files Browse the repository at this point in the history
Unfortunately, we return errors over the HTTP API and lose the type.


This commit was moved from ipfs/interface-go-ipfs-core@98e7257

This commit was moved from ipfs/boxo@b722930
  • Loading branch information
Stebalien committed Aug 17, 2021
1 parent 58c9824 commit f909368
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/coreiface/tests/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package tests

import (
"context"
"errors"
"math"
"strings"
"testing"

"github.com/ipfs/go-path/resolver"
"github.com/ipfs/interface-go-ipfs-core/path"

"github.com/ipfs/interface-go-ipfs-core/options"
Expand Down Expand Up @@ -141,7 +139,7 @@ func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) {
}

_, err = api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/bar/baz"))
if err == nil || !errors.As(err, &resolver.ErrNoLink{}) {
if err == nil || !strings.Contains(err.Error(), `no link named "bar"`) {
t.Fatalf("unexpected error: %s", err)
}
}
Expand Down

0 comments on commit f909368

Please sign in to comment.