aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wallace <doof@doof.net>2019-02-22 00:30:03 -0800
committerKevin Wallace <doof@doof.net>2019-02-22 00:30:03 -0800
commit191d8306062692a204603eda2ea307ed8c726598 (patch)
treefcb17f28c5dc0cb70dbff5f18e3b7e128fa620c1
parentsilence "no such host" errors (diff)
catch NXDOMAIN-related errors on OSX, too
Maybe time to move off of the stdlib dns library. This error handling sucks.
-rw-r--r--main.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.go b/main.go
index af00591..ca024a9 100644
--- a/main.go
+++ b/main.go
@@ -45,7 +45,10 @@ func main() {
}
func printErr(ip net.IP, rrtype string, err error) {
- if !strings.Contains(err.Error(), "no such host") {
+ // the error types here are awful and this feels like it might
+ // accidentally catch some non-NXDOMAIN errors
+ if !strings.HasSuffix(err.Error(), "no such host") &&
+ !strings.HasSuffix(err.Error(), "nodename nor servname provided, or not known") {
fmt.Fprintf(os.Stderr, "%s\t# %s error: %s\n", ip, rrtype, err)
}
}