show the domain name with the error (#7886)

* show the domain name if DNSLink failed to resolve a domain because it wasn't a valid domain name

Original author: @AluisioASG
This commit is contained in:
@RubenKelevra 2021-01-28 21:22:36 +01:00 committed by GitHub
parent 6f6f04543b
commit dd295e4560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"errors"
"net"
"strings"
"fmt"
path "github.com/ipfs/go-path"
opts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
@ -53,7 +54,7 @@ func (r *DNSResolver) resolveOnceAsync(ctx context.Context, name string, options
domain := segments[0]
if !isd.IsDomain(domain) {
out <- onceResult{err: errors.New("not a valid domain name")}
out <- onceResult{err: fmt.Errorf("not a valid domain name: %s", domain)}
close(out)
return out
}