errors.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2015 The etcd Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package etcdserver
  15. import (
  16. "errors"
  17. "fmt"
  18. )
  19. var (
  20. ErrUnknownMethod = errors.New("etcdserver: unknown method")
  21. ErrStopped = errors.New("etcdserver: server stopped")
  22. ErrCanceled = errors.New("etcdserver: request cancelled")
  23. ErrTimeout = errors.New("etcdserver: request timed out")
  24. ErrTimeoutDueToLeaderFail = errors.New("etcdserver: request timed out, possibly due to previous leader failure")
  25. ErrTimeoutDueToConnectionLost = errors.New("etcdserver: request timed out, possibly due to connection lost")
  26. ErrTimeoutLeaderTransfer = errors.New("etcdserver: request timed out, leader transfer took too long")
  27. ErrLeaderChanged = errors.New("etcdserver: leader changed")
  28. ErrNotEnoughStartedMembers = errors.New("etcdserver: re-configuration failed due to not enough started members")
  29. ErrLearnerNotReady = errors.New("etcdserver: can only promote a learner member which is in sync with leader")
  30. ErrNoLeader = errors.New("etcdserver: no leader")
  31. ErrNotLeader = errors.New("etcdserver: not leader")
  32. ErrRequestTooLarge = errors.New("etcdserver: request is too large")
  33. ErrNoSpace = errors.New("etcdserver: no space")
  34. ErrTooManyRequests = errors.New("etcdserver: too many requests")
  35. ErrUnhealthy = errors.New("etcdserver: unhealthy cluster")
  36. ErrKeyNotFound = errors.New("etcdserver: key not found")
  37. ErrCorrupt = errors.New("etcdserver: corrupt cluster")
  38. ErrBadLeaderTransferee = errors.New("etcdserver: bad leader transferee")
  39. )
  40. type DiscoveryError struct {
  41. Op string
  42. Err error
  43. }
  44. func (e DiscoveryError) Error() string {
  45. return fmt.Sprintf("failed to %s discovery cluster (%v)", e.Op, e.Err)
  46. }