Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request : A Status Code to indicate Success or Failure (instead of just errorCode in event of failure) #83

Closed
conikeec opened this issue Aug 11, 2013 · 5 comments

Comments

@conikeec
Copy link

In event of a network failure, an insert into etcd might fail, but an external process might query of an non-existent key for variety of reasons.

Non-existent keys send a distinct failed message:

{"errorCode":100,"message":"Key Not Found","cause":"/D0A1A866-6591-40CF-99EE-15AE1BF3A7F1"}

Successful value fetch from key does not hold a statusCode at this point

[{"action":"GET","key":"/51b8cc7c-c7d8-4d6e-86ee-1a381db2f068/status","value":"COMPLETED","expiration":"2013-08-11T06:04:23.647167583-07:00","ttl":29849,"index":97}]

Is it possible to add an upper level 'statusCode' to indicate success or failure instead of just passing errorCode on event of a failure?

Client(s) can then use the statusCode to make deterministic logic flow.

@xiang90
Copy link
Contributor

xiang90 commented Aug 11, 2013

@conikeec Http status code is different. Is it enough for your usage?

@conikeec
Copy link
Author

I am currently using HTTP codes the terminate flow.
Was wondering if it might be ideal to tack on a statusCode on successful returns as well?
Thoughts?

@xiang90
Copy link
Contributor

xiang90 commented Aug 11, 2013

@conikeec
The current work flow of etcd is
query store -> generate response
if response is not null, return response and http 200
or generate error message and http fail code.

First, I feel return response status code is a little bit duplicate with http status code.
Second if we use {statusCode: <code> {error json/ response json} }, we need to decode twice.

@conikeec
Copy link
Author

Got it .. Agree with you ...
Thanks for clarifying.
Please close ...

@xiang90
Copy link
Contributor

xiang90 commented Aug 11, 2013

@conikeec If you have any questions, just open an issue. PR and issues are always welcomed.

@xiang90 xiang90 closed this as completed Aug 11, 2013
xiang90 added a commit that referenced this issue Sep 4, 2014
snapshot: move pb to snappb; remove clusterId
hexfusion pushed a commit to hexfusion/etcd that referenced this issue Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants