refactor: Remove old error handling library
Removes the old error handling library and switches to plain fmt.Errorf calls. There are several reasons for this: * There are no useful types or handling here anyways, so output format is the only priority. * Users don't care about getting stacktraces. * My emotional wellbeing. Fin de siècle.
This commit is contained in:
parent
b8722ce83b
commit
3aa2cb8d3e
7 changed files with 13 additions and 78 deletions
|
|
@ -14,26 +14,16 @@ package templater
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/polydawn/meep"
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
|
||||
type DNSError struct {
|
||||
meep.TraitAutodescribing
|
||||
meep.TraitCausable
|
||||
Output string
|
||||
}
|
||||
|
||||
func GetIPsFromDNS(host string) ([]interface{}, error) {
|
||||
fmt.Fprintf(os.Stderr, "Attempting to look up IP for %s in DNS\n", host)
|
||||
ips, err := net.LookupIP(host)
|
||||
|
||||
if err != nil {
|
||||
return nil, meep.New(
|
||||
&DNSError{Output: "IP address lookup failed"},
|
||||
meep.Cause(err),
|
||||
)
|
||||
return nil, fmt.Errorf("IP address lookup failed: %v", err)
|
||||
}
|
||||
|
||||
var result []interface{} = make([]interface{}, len(ips))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue