Make RESTful operations return 404 Not Found when the target resource
does not exist. In the original implementation, GET, DELETE and PUT operations on non-existent resources used to return 500 but not 404.
This commit is contained in:
@@ -72,20 +72,8 @@ func IsEtcdConflict(err error) bool {
|
||||
|
||||
// Returns true iff err is an etcd error, whose errorCode matches errorCode
|
||||
func isEtcdErrorNum(err error, errorCode int) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
switch err.(type) {
|
||||
case *etcd.EtcdError:
|
||||
etcdError := err.(*etcd.EtcdError)
|
||||
if etcdError == nil {
|
||||
return false
|
||||
}
|
||||
if etcdError.ErrorCode == errorCode {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
etcdError, ok := err.(*etcd.EtcdError)
|
||||
return ok && etcdError != nil && etcdError.ErrorCode == errorCode
|
||||
}
|
||||
|
||||
func (h *EtcdHelper) listEtcdNode(key string) ([]*etcd.Node, error) {
|
||||
|
Reference in New Issue
Block a user