errors.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. Client Prefix = "Client"
  14. Query Prefix = "Query"
  15. Params Prefix = "Params"
  16. )
  17. var (
  18. OutOfMemory = e.New("Out of memory")
  19. ClientUDPuFailed = e.New("Failed to bind to any unicast address.")
  20. ClientUDPmFailed = e.New("Failed to bind to any multicast address.")
  21. HostIsNil = e.New("Host is nil.")
  22. ServerIsNil = e.New("Server is nil.")
  23. HostStringIsEmpty = e.New("String is empty.")
  24. HostStringIsInvalid = e.New("String is invalid.")
  25. HostStringIsInvalidInstance = e.New("String is not an instance, e.g <Readable description>.")
  26. HostStringIsInvalidService = e.New("String is not a service, e.g <_service._tcp> or <_service._udp>.")
  27. HostStringIsInvalidDomain = e.New("String is no a valid domain, e.g <local> or <my.domain>.")
  28. HostStringIsInvalidHostname = e.New("Hostname is invalid.")
  29. HostIPIsInvalid = e.New("IP address(es) is not valid for hostname.")
  30. HostPortIsInvalid = e.New("Port number is invalid (p < 0 || p > 65535).")
  31. HostTXTExceedsLimit = e.New("TXT record exceed intended size -- 200 bytes or less.")
  32. ServerNoListenersStarted = e.New("No multicast listeners started.")
  33. ServerReceivedNonQueryOpcode = e.New("Received non-query Opcode")
  34. ServerReceivedNonZeroRcode = e.New("Received non-zero Rcode")
  35. ServerReceivedTruncatedSet = e.New("Reveived trucated bit set")
  36. ServerNoResponseForQuestion = e.New("No response for question.")
  37. ServerUnknownConnectionAddr = e.New("Unknown connection on IP.")
  38. )
  39. func (p Prefix) String() string {
  40. return string(p) + ":"
  41. }