cleaner dns error handling
This commit is contained in:
parent
c9ea462e97
commit
963d9209ca
1 changed files with 3 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
|
|
@ -126,10 +127,8 @@ func classifyError(err error) string {
|
|||
msg := err.Error()
|
||||
|
||||
// DNS errors
|
||||
if _, ok := err.(*net.DNSError); ok {
|
||||
return "dns"
|
||||
}
|
||||
if strings.Contains(msg, "no such host") || strings.Contains(msg, "dns") {
|
||||
var dnsErr *net.DNSError
|
||||
if errors.As(err, &dnsErr) {
|
||||
return "dns"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue