hashicorp / hashicorp/consul

txn feature request: more info on cas failure

Open
#3,090 0 comments 0 reactions 0 assignees View on GitHub
theme/api type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

A cas operation normally returns two results (a boolean result indicating whether the check operation succeeded or not and a server error).

However, a failure on cas in txn gives us a single error message. If we need to know the cause of the error, we must parse the error string which is quite unreliable.

For example, suppose that I don't have a write permission on key `key1`. The error response looks like the following:
```
HTTP/1.1 409 Conflict
{"Results":null,"Errors":[{"OpIndex":0,"What":"Permission denied"}]}
```

If a check operation fails, then the error response would look like this:
```
HTTP/1.1 409 Conflict
{"Results":null,"Errors":[{"OpIndex":0,"What":"failed to set key \"key1\", index is stale"}]}
```

The only way to distinguish it from other server errors is checking the error message itself and no one would like it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.