couchbase/couchbase-lite-android-core — pull request #16 by mjq (2013-11-15 17:48:36+00:00)
Title: Properly report error when view query fails

CBLRouter.queryDesignDoc falsely reports success when CBLView.queryWithOptions hits a SQLException and returns null. In that case, queryWithOptions returns the current value of 'status', which is always a successful one (see [CBLRouter:L1463](https://github.com/couchbase/couchbase-lite-android-core/blob/master/src/main/java/com/couchbase/cblite/router/CBLRouter.java#L1463)), resulting in a malformed response.

This manifests itself in error logs like:
```
[org.ektorp.ViewResult:L30] IllegalArgumentException: result must contain 'rows' field of array type
```
as Ektorp tries to make assertions about the incorrectly-successful result.

This patch changes queryDesignDoc to return an INTERNAL_SERVER_ERROR status in this case.