Skip to content

Commit

Permalink
Check for N1QL errors even on non-200 status codes.
Browse files Browse the repository at this point in the history
At some point, N1QL was updated to return a 200 status code
even in the case of an error occuring.  The previous logic
caused these errors to be ignored, and an empty result set
to be returned instead.

Change-Id: Id70e89d0c25a460ac940c50e497d3b2a9c6ecbd1
Reviewed-on: http://review.couchbase.org/63114
Reviewed-by: Mark Nunberg <mark.nunberg@couchbase.com>
Tested-by: Brett Lawson <brett19@gmail.com>
  • Loading branch information
brett19 committed Apr 20, 2016
1 parent 4c3b1a3 commit 42df07f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cluster_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ func (c *Cluster) executeN1qlQuery(n1qlEp string, opts map[string]interface{}, c

resp.Body.Close()

if resp.StatusCode != 200 {
if len(n1qlResp.Errors) > 0 {
return nil, (*n1qlMultiError)(&n1qlResp.Errors)
}
if len(n1qlResp.Errors) > 0 {
return nil, (*n1qlMultiError)(&n1qlResp.Errors)
}

if resp.StatusCode != 200 {
return nil, &viewError{
Message: "HTTP Error",
Reason: fmt.Sprintf("Status code was %d.", resp.StatusCode),
Expand Down

0 comments on commit 42df07f

Please sign in to comment.