Commit Graph

23 Commits (ccb960f47f357004bd9e68734628788d2512bd25)

Author SHA1 Message Date
Cenk Alti 303a3096d4 refactor(errors): use map literal syntax
Error strings align better this way.
2014-03-25 20:17:21 -07:00
Ben Johnson fe4dee03ab Minor fixes. 2014-03-04 09:29:44 -07:00
Ben Johnson c8d6b26dfd Add auto-demotion after peer inactivity. 2014-03-03 11:15:05 -07:00
Ben Johnson 1d961b8e56 Add proxy mode. 2014-02-22 15:02:20 -07:00
Brandon Philips 1b00c449a5 Revert "Better error message when setting values on directories"
This reverts commit d13dd50d51.
2014-01-23 11:22:11 -08:00
Kelsey Hightower d13dd50d51 Better error message when setting values on directories
Without this commit etcd returns the following error message when
setting values on directories:

    {
      "errorCode":102,
      "message":"Not a file",
      "cause":"/postgres",
      "index":2
    }

While the above error message is accurate it's not very descriptive.
This commit adds a new error code/message which better describes why the
write operation failed. etcd now returns the following:

    {
      "errorCode":109,
      "message":"Cannot set value on directory",
      "cause":"/postgres",
      "index":2
    }
2014-01-22 23:02:33 -08:00
Ben Johnson cde184fdbf Fix mod/lock and mod/leader return error codes. 2014-01-14 07:57:30 -07:00
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