Description
When errors occur after the "results" portion of the N1QL query response, no exception is thrown. This is rare, but can happen if the server encounters a problem after result streaming begins.
Additionally, it seems to consistently happen if the error is related to RBAC:
{
|
"requestID": "033651a5-4138-4617-9bb6-6e0e0d0eb218",
|
"signature": {
|
"*": "*"
|
},
|
"results": [],
|
"errors": [
|
{
|
"code": 13014,
|
"msg": "User does not have credentials to run SELECT queries on the default bucket. Add role query_select on default to allow the query to run."
|
}
|
],
|
"status": "fatal",
|
"metrics": {
|
"elapsedTime": "7.574158ms",
|
"executionTime": "7.510357ms",
|
"resultCount": 0,
|
"resultSize": 0,
|
"errorCount": 1
|
}
|
}
|
I recommend two changes:
- After we get done iterating through the list, check for errors and throw an exception if they are found for consistency
- If possible, detect the empty result array case early so we can throw the exception before the result set is iterated
Forum post: https://forums.couchbase.com/t/cannot-execute-n1ql-queries-with-couchbase-net-sdk-3-0/27707/8
Attachments
For Gerrit Dashboard: NCBC-2657 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
136957,2 | NCBC-2657: Handle errors after results array on 200 status | master | couchbase-net-client | Status: MERGED | +2 | +1 |