error.go 842 B

1234567891011121314151617181920212223242526272829303132
  1. package support
  2. import "strconv"
  3. // KeySizeError is an error that occurs when a key has an incorrect length.
  4. type KeySizeError int
  5. func (k KeySizeError) Error() string {
  6. return "invalid key size " + strconv.Itoa(int(k))
  7. }
  8. // NonceSizeError is an error that occurs when a nonce has an incorrect length.
  9. type NonceSizeError int
  10. func (k NonceSizeError) Error() string {
  11. return "invalid nonce size " + strconv.Itoa(int(k))
  12. }
  13. // NilPointerError is an error that occurs when a pointer is a nil pointer
  14. type NilPointerError string
  15. func (k NilPointerError) Error() string {
  16. return string(k) + " is a nil pointer"
  17. }
  18. // VerificationError is an error that occurs when the verification of
  19. // a signature or authentication tag fails.
  20. type VerificationError struct {}
  21. func (k VerificationError) Error() string {
  22. return "verification failed"
  23. }