16 Commits

Author SHA1 Message Date
Chris Shoemaker
d89fa131ab feat(v2/errors): Use more appropriate HTTP status codes for error cases.
This commits adds test coverage for all the error and non-error cases
described below, but only the behavior of the 403, 404 and 412 cases
are changing in this commit.

When setting a key results in a new resource, we asset an HTTP status
code of 201 (aka "Created").

When attempting to get a resource that doesn't exist, we assert an
HTTP status code of 404 (aka "Not Found").

When attempting to delete a directory without dir=true, or a non-empty
directory without recursive=true, but the request is otherwise valid,
we assert an HTTP status code of 403 (aka "Forbidden").

When a precondition (e.g. specified by prevIndex, or prevValue) is not
met, but the request is otherwise syntactically valid, we assert an
HTTP status code of 412 (aka "Precondition Failed").  However,
prevExist is handled slightly differently.  If prevExist=false fails,
then this is treated like a failed precondition, so it should use
PreconditionFailed.  But, if prevExist=true fails, then this is
treated like other requests that require the existence of the
resource, and uses NotFound if the resource doesn't exist.

We continue to assert an HTTP status code of 400 when the request is
syntactically invalid (e.g. when prevIndex=bad_index).
2013-12-21 21:39:19 -05:00
Chris Shoemaker
39fb266776 fix(error.go): fix typo in comment 2013-12-21 21:39:19 -05:00
Xiang Li
636dad190e refactor(error.go) error messages 2013-12-05 17:50:20 -05:00
Xiang Li
40d297be66 feat add dir_flag 2013-12-05 17:10:37 -05:00
Xiang Li
6252037376 fix root should be rdonly 2013-12-01 18:01:24 -05:00
Ben Johnson
cba2611c68 Renamed configuration parameters. 2013-11-15 00:13:32 -05:00
Xiang Li
5abbaf59e3 Merge pull request #292 from xiangli-cmu/fix-ttl
WIP: fix ttl
2013-11-11 21:30:32 -08:00
Xiang Li
6156d5c790 refactor separate etcd index from raft index 2013-11-09 17:55:54 -08:00
Brandon Philips
6a074d4f6f chore(*.go): add copyright notice 2013-11-08 14:04:15 -08:00
Xiang Li
baaaf24f70 (feat) v1 apt backward support 2013-10-06 11:23:52 -07:00
Xiang Li
512dede9ce finish todo 2013-10-02 22:15:12 -07:00
Xiang Li
da83ee223b clean up from yifan 2013-09-28 16:26:19 -07:00
Hongchao Deng
effc8285f2 New error-system for Etcd with docs 2013-09-08 18:46:16 -04:00
Xiang Li
227d79e2bf support testandset 2013-09-05 15:38:22 -04:00
Xiang Li
329f8c4fa3 init filesystem 2013-09-03 14:30:42 -04:00
Xiang Li
cf2d6888c2 add error package 2013-08-17 20:41:15 -07:00