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:
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