defs.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package errdefs
  2. // ErrNotFound signals that the requested object doesn't exist
  3. type ErrNotFound interface {
  4. NotFound()
  5. }
  6. // ErrInvalidParameter signals that the user input is invalid
  7. type ErrInvalidParameter interface {
  8. InvalidParameter()
  9. }
  10. // ErrConflict signals that some internal state conflicts with the requested action and can't be performed.
  11. // A change in state should be able to clear this error.
  12. type ErrConflict interface {
  13. Conflict()
  14. }
  15. // ErrUnauthorized is used to signify that the user is not authorized to perform a specific action
  16. type ErrUnauthorized interface {
  17. Unauthorized()
  18. }
  19. // ErrUnavailable signals that the requested action/subsystem is not available.
  20. type ErrUnavailable interface {
  21. Unavailable()
  22. }
  23. // ErrForbidden signals that the requested action cannot be performed under any circumstances.
  24. // When a ErrForbidden is returned, the caller should never retry the action.
  25. type ErrForbidden interface {
  26. Forbidden()
  27. }
  28. // ErrSystem signals that some internal error occurred.
  29. // An example of this would be a failed mount request.
  30. type ErrSystem interface {
  31. ErrSystem()
  32. }
  33. // ErrNotModified signals that an action can't be performed because it's already in the desired state
  34. type ErrNotModified interface {
  35. NotModified()
  36. }
  37. // ErrAlreadyExists is a special case of ErrConflict which signals that the desired object already exists
  38. type ErrAlreadyExists interface {
  39. AlreadyExists()
  40. }
  41. // ErrNotImplemented signals that the requested action/feature is not implemented on the system as configured.
  42. type ErrNotImplemented interface {
  43. NotImplemented()
  44. }
  45. // ErrUnknown signals that the kind of error that occurred is not known.
  46. type ErrUnknown interface {
  47. Unknown()
  48. }
  49. // ErrCancelled signals that the action was cancelled.
  50. type ErrCancelled interface {
  51. Cancelled()
  52. }
  53. // ErrDeadline signals that the deadline was reached before the action completed.
  54. type ErrDeadline interface {
  55. DeadlineExceeded()
  56. }
  57. // ErrDataLoss indicates that data was lost or there is data corruption.
  58. type ErrDataLoss interface {
  59. DataLoss()
  60. }