You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

errors.go 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Copyright (c) 2012-2014 Jeremy Latt
  2. // Copyright (c) 2014-2015 Edmund Huber
  3. // Copyright (c) 2016-2017 Daniel Oaks <daniel@danieloaks.net>
  4. // released under the MIT license
  5. package irc
  6. import (
  7. "errors"
  8. "fmt"
  9. "github.com/oragono/oragono/irc/utils"
  10. )
  11. // Runtime Errors
  12. var (
  13. errAccountAlreadyRegistered = errors.New(`Account already exists`)
  14. errAccountAlreadyUnregistered = errors.New(`That account name was registered previously and can't be reused`)
  15. errAccountAlreadyVerified = errors.New(`Account is already verified`)
  16. errAccountCantDropPrimaryNick = errors.New("Can't unreserve primary nickname")
  17. errAccountCreation = errors.New("Account could not be created")
  18. errAccountDoesNotExist = errors.New("Account does not exist")
  19. errAccountInvalidCredentials = errors.New("Invalid account credentials")
  20. errAccountBadPassphrase = errors.New(`Passphrase contains forbidden characters or is otherwise invalid`)
  21. errAccountNickReservationFailed = errors.New("Could not (un)reserve nick")
  22. errAccountNotLoggedIn = errors.New("You're not logged into an account")
  23. errAccountAlreadyLoggedIn = errors.New("You're already logged into an account")
  24. errAccountTooManyNicks = errors.New("Account has too many reserved nicks")
  25. errAccountUnverified = errors.New(`Account is not yet verified`)
  26. errAccountVerificationFailed = errors.New("Account verification failed")
  27. errAccountVerificationInvalidCode = errors.New("Invalid account verification code")
  28. errAccountUpdateFailed = errors.New(`Error while updating your account information`)
  29. errAccountMustHoldNick = errors.New(`You must hold that nickname in order to register it`)
  30. errAuthzidAuthcidMismatch = errors.New(`authcid and authzid must be the same`)
  31. errCallbackFailed = errors.New("Account verification could not be sent")
  32. errCertfpAlreadyExists = errors.New(`An account already exists for your certificate fingerprint`)
  33. errChannelNotOwnedByAccount = errors.New("Channel not owned by the specified account")
  34. errChannelTransferNotOffered = errors.New(`You weren't offered ownership of that channel`)
  35. errChannelAlreadyRegistered = errors.New("Channel is already registered")
  36. errChannelNotRegistered = errors.New("Channel is not registered")
  37. errChannelNameInUse = errors.New(`Channel name in use`)
  38. errInvalidChannelName = errors.New(`Invalid channel name`)
  39. errMonitorLimitExceeded = errors.New("Monitor limit exceeded")
  40. errNickMissing = errors.New("nick missing")
  41. errNicknameInvalid = errors.New("invalid nickname")
  42. errNicknameInUse = errors.New("nickname in use")
  43. errInsecureReattach = errors.New("insecure reattach")
  44. errNicknameReserved = errors.New("nickname is reserved")
  45. errNickAccountMismatch = errors.New(`Your nickname must match your account name; try logging out and logging back in with SASL`)
  46. errNoExistingBan = errors.New("Ban does not exist")
  47. errNoSuchChannel = errors.New(`No such channel`)
  48. errChannelPurged = errors.New(`This channel was purged by the server operators and cannot be used`)
  49. errConfusableIdentifier = errors.New("This identifier is confusable with one already in use")
  50. errInsufficientPrivs = errors.New("Insufficient privileges")
  51. errInvalidUsername = errors.New("Invalid username")
  52. errFeatureDisabled = errors.New(`That feature is disabled`)
  53. errBanned = errors.New("IP or nickmask banned")
  54. errInvalidParams = utils.ErrInvalidParams
  55. errNoVhost = errors.New(`You do not have an approved vhost`)
  56. errVhostsForbidden = errors.New(`An administrator has denied you the ability to use vhosts`)
  57. errLimitExceeded = errors.New("Limit exceeded")
  58. errNoop = errors.New("Action was a no-op")
  59. errCASFailed = errors.New("Compare-and-swap update of database value failed")
  60. errEmptyCredentials = errors.New("No more credentials are approved")
  61. errCredsExternallyManaged = errors.New("Credentials are externally managed and cannot be changed here")
  62. errInvalidMultilineBatch = errors.New("Invalid multiline batch")
  63. )
  64. // Socket Errors
  65. var (
  66. errNoPeerCerts = errors.New("Client did not provide a certificate")
  67. errNotTLS = errors.New("Not a TLS connection")
  68. errReadQ = errors.New("ReadQ Exceeded")
  69. )
  70. // String Errors
  71. var (
  72. errCouldNotStabilize = errors.New("Could not stabilize string while casefolding")
  73. errStringIsEmpty = errors.New("String is empty")
  74. errInvalidCharacter = errors.New("Invalid character")
  75. )
  76. type CertKeyError struct {
  77. Err error
  78. }
  79. func (ck *CertKeyError) Error() string {
  80. return fmt.Sprintf("Invalid TLS cert/key pair: %v", ck.Err)
  81. }
  82. // Config Errors
  83. var (
  84. ErrDatastorePathMissing = errors.New("Datastore path missing")
  85. ErrLimitsAreInsane = errors.New("Limits aren't setup properly, check them and make them sane")
  86. ErrLineLengthsTooSmall = errors.New("Line lengths must be 512 or greater (check the linelen section under server->limits)")
  87. ErrLoggerExcludeEmpty = errors.New("Encountered logging type '-' with no type to exclude")
  88. ErrLoggerFilenameMissing = errors.New("Logging configuration specifies 'file' method but 'filename' is empty")
  89. ErrLoggerHasNoTypes = errors.New("Logger has no types to log")
  90. ErrNetworkNameMissing = errors.New("Network name missing")
  91. ErrNoFingerprintOrPassword = errors.New("Fingerprint or password needs to be specified")
  92. ErrNoListenersDefined = errors.New("Server listening addresses missing")
  93. ErrOperClassDependencies = errors.New("OperClasses contains a looping dependency, or a class extends from a class that doesn't exist")
  94. ErrServerNameMissing = errors.New("Server name missing")
  95. ErrServerNameNotHostname = errors.New("Server name must match the format of a hostname")
  96. )