Description
When using Couchbase Server 5.x, and you get a lock related error, the Status filed is set of "Failure" (-3) and the Exception field is set to null.
You can reproduce with the following code:
var cluster = new Cluster(new ClientConfiguration |
{
|
Servers = new List<Uri> { new Uri("http://10.111.175.101") } |
});
|
|
var authenticator = new PasswordAuthenticator("user", "password"); |
cluster.Authenticate(authenticator);
|
var bucket = cluster.OpenBucket("test"); |
|
dynamic attempt1 = bucket.GetAndLock<dynamic>("12345", TimeSpan.FromSeconds(10)); |
dynamic attempt2 = bucket.GetAndLock<dynamic>("12345", TimeSpan.FromSeconds(10)); |
attempt2 above should be the "bad" result.
Attachments
Issue Links
- relates to
-
NCBC-1500 SDKs must translate LOCKED status code to existing Errors.
-
- Resolved
-
I need to look deeper into the Error Map RFC, but the logic here doesn't seem right; if the server sends a status, the client should respect and return it back to the application not convert it to a generic "failure" status. Any additional error map information is just a bonus.
As for the exception field be null, its because there is no generated exception (in this case it would be the expected output given the input) - its simply the server status of the operation request. That being said, an exception which includes the status and any additional error map information could be returned. It does seem a bit redundant, tbh.