errors.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package errors
  2. import (
  3. e "errors"
  4. )
  5. type Prefix string
  6. const (
  7. Zone Prefix = "Zone"
  8. Host Prefix = "Host"
  9. HostString Prefix = "HostString"
  10. HostIP Prefix = "HostIP"
  11. HostPort Prefix = "HostPort"
  12. Server Prefix = "Server"
  13. )
  14. var (
  15. OutOfMemory = e.New("Out of memory")
  16. HostIsNil = e.New("Host is nil.")
  17. ServerIsNil = e.New("Server is nil.")
  18. HostStringIsEmpty = e.New("String is empty.")
  19. HostStringIsInvalid = e.New("String is invalid.")
  20. HostStringIsInvalidInstance = e.New("String is not an instance, e.g <Readable description>.")
  21. HostStringIsInvalidService = e.New("String is not a service, e.g <_service._tcp> or <_service._udp>.")
  22. HostStringIsInvalidDomain = e.New("String is no a valid domain, e.g <local> or <my.domain>.")
  23. HostStringIsInvalidHostname = e.New("Hostname is invalid.")
  24. HostIPIsInvalid = e.New("IP address(es) is not valid for hostname.")
  25. HostPortIsInvalid = e.New("Port number is invalid (p < 0 || p > 65535).")
  26. HostTXTExceedsLimit = e.New("TXT record exceed intended size -- 200 bytes or less.")
  27. ServerNoListenersStarted = e.New("No multicast listeners started.")
  28. ServerReceivedNonQueryOpcode = e.New("Received non-query Opcode")
  29. ServerReceivedNonZeroRcode = e.New("Received non-zero Rcode")
  30. ServerReceivedTruncatedSet = e.New("Reveived trucated bit set")
  31. ServerNoResponseForQuestion = e.New("No response for question.")
  32. )
  33. func (p Prefix) String() string {
  34. return string(p) + ":"
  35. }