mirror of https://github.com/namecoin/ncdns
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
687 B
Go
36 lines
687 B
Go
package ncerr
|
|
import "github.com/miekg/dns"
|
|
import "fmt"
|
|
|
|
// An Error interface which allows an associated rcode to be queried.
|
|
type Error interface {
|
|
error
|
|
Rcode() int
|
|
}
|
|
|
|
type Rerr struct {
|
|
error
|
|
e error
|
|
rcode int
|
|
}
|
|
|
|
func (re *Rerr) Error() string {
|
|
return re.e.Error()
|
|
}
|
|
|
|
func (re *Rerr) Rcode() int {
|
|
return re.rcode
|
|
}
|
|
|
|
func rerrorf(rcode int, fmts string, args ...interface{}) Error {
|
|
re := &Rerr{}
|
|
re.e = fmt.Errorf(fmts, args...)
|
|
re.rcode = rcode
|
|
return re
|
|
}
|
|
|
|
// Standard errors.
|
|
var ErrNoSuchDomain = rerrorf(dns.RcodeNameError, "no such domain")
|
|
var ErrNotInZone = rerrorf(dns.RcodeRefused, "domain not in zone")
|
|
var ErrNoResults = rerrorf(0, "no results")
|