errors.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2015 CoreOS, Inc.
  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. etcdErr "github.com/coreos/etcd/error"
  18. )
  19. var (
  20. ErrUnknownMethod = errors.New("etcdserver: unknown method")
  21. ErrStopped = errors.New("etcdserver: server stopped")
  22. ErrIDRemoved = errors.New("etcdserver: ID removed")
  23. ErrIDExists = errors.New("etcdserver: ID exists")
  24. ErrIDNotFound = errors.New("etcdserver: ID not found")
  25. ErrPeerURLexists = errors.New("etcdserver: peerURL exists")
  26. ErrCanceled = errors.New("etcdserver: request cancelled")
  27. ErrTimeout = errors.New("etcdserver: request timed out")
  28. ErrTimeoutDueToLeaderFail = errors.New("etcdserver: request timed out, possibly due to previous leader failure")
  29. )
  30. func isKeyNotFound(err error) bool {
  31. e, ok := err.(*etcdErr.Error)
  32. return ok && e.ErrorCode == etcdErr.EcodeKeyNotFound
  33. }