Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Inconsistent behavior when handling various error states #32

Closed
MartinPodval opened this issue Feb 27, 2015 · 2 comments
Closed

Inconsistent behavior when handling various error states #32

MartinPodval opened this issue Feb 27, 2015 · 2 comments

Comments

@MartinPodval
Copy link

This topic https://github.com/coreos/etcd/blob/master/Documentation/errorcode.md defines a set of possible error codes which can etcd server return to your request. The server returns both http status code and json body as well. The server does it even in error states.

On the other hand EtcdKeyResponseHandler parses only some http status codes into EtcdException body.

This means that when I send a request to get not existing key, the etcd client returns EtcdException with error code 101. Contrary to this behavior, when I send a request using prevExist=false and the request fails, a new Exception is thrown containing message "412 Precondition Failed". I need to parse the text using HttpResponseStatus.parseLine in this case to discover what happen.

I would suggest to throw an EtcdException with proper error code in all cases when possible.

@jurmous
Copy link
Owner

jurmous commented Mar 2, 2015

You are right. It also seems that newer etcds respond with some different http codes in some situations. I will adapt code to always try to make an etcd exception.

@jurmous jurmous closed this as completed in 43223a5 Mar 2, 2015
@jurmous
Copy link
Owner

jurmous commented Mar 2, 2015

Released in 2.2.0. Thanks for reporting the issue in!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants