Skip to content

Commit

Permalink
deploy: fix broken missing NNS record detection
Browse files Browse the repository at this point in the history
Real errors are returned like this:
   "error": "call 'resolve' method of the NNS contract: invocation failed: at instruction 4100 (THROW): unhandled exception: \"token not found\""
So it can't be a simple equality check.

Signed-off-by: Roman Khimov <[email protected]>
  • Loading branch information
roman-khimov committed Jun 14, 2024
1 parent f16f0f4 commit aafb87f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deploy/nns.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"
"time"

"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
Expand Down Expand Up @@ -190,7 +191,7 @@ func lookupNNSDomainRecord(inv *invoker.Invoker, nnsContract util.Uint160, domai
item, err := unwrap.Item(inv.Call(nnsContract, methodNNSResolve, domainName, int64(nns.TXT)))
if err != nil {
var except unwrap.Exception
if errors.As(err, &except) && string(except) == "token not found" {
if errors.As(err, &except) && strings.Contains(except, "token not found") {

Check failure on line 194 in deploy/nns.go

View workflow job for this annotation

GitHub Actions / Tests (1.20, ubuntu-latest)

cannot use except (variable of type unwrap.Exception) as string value in argument to strings.Contains

Check failure on line 194 in deploy/nns.go

View workflow job for this annotation

GitHub Actions / Tests (1.21, ubuntu-latest)

cannot use except (variable of type unwrap.Exception) as string value in argument to strings.Contains

Check failure on line 194 in deploy/nns.go

View workflow job for this annotation

GitHub Actions / Tests (1.22, ubuntu-latest)

cannot use except (variable of type unwrap.Exception) as string value in argument to strings.Contains

Check failure on line 194 in deploy/nns.go

View workflow job for this annotation

GitHub Actions / Tests (1.22, windows-2022)

cannot use except (variable of type unwrap.Exception) as string value in argument to strings.Contains

Check failure on line 194 in deploy/nns.go

View workflow job for this annotation

GitHub Actions / Tests (1.22, macos-14)

cannot use except (variable of type unwrap.Exception) as string value in argument to strings.Contains
return "", errMissingDomain
}

Expand Down

0 comments on commit aafb87f

Please sign in to comment.