Increased test timeout for ql-based delete, added proper error handling in connections response
diff --git a/lib/client.js b/lib/client.js
index d97a014..4fc5c87 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -81,6 +81,9 @@
json: true
}, function(error, response) {
var usergridResponse = new UsergridResponse(response)
+ if (response.statusCode !== 200) {
+ error = new UsergridResponseError(response.body)
+ }
options.callback(error, usergridResponse, usergridResponse.entities)
})
},
@@ -93,6 +96,9 @@
json: true
}, function(error, response) {
var usergridResponse = new UsergridResponse(response)
+ if (response.statusCode !== 200) {
+ error = new UsergridResponseError(response.body)
+ }
options.callback(error, usergridResponse, usergridResponse.entities)
})
},
@@ -105,6 +111,9 @@
json: true
}, function(error, response) {
var usergridResponse = new UsergridResponse(response)
+ if (response.statusCode !== 200) {
+ error = new UsergridResponseError(response.body)
+ }
options.callback(error, usergridResponse, usergridResponse.entities)
})
},
diff --git a/tests/lib/client.test.js b/tests/lib/client.test.js
index eddc43b..4ca0772 100644
--- a/tests/lib/client.test.js
+++ b/tests/lib/client.test.js
@@ -453,7 +453,7 @@
it('should support deleting multiple entities by passing a UsergridQuery object', function(done) {
this.slow(_slow + 1000)
- this.timeout(_timeout + 1000)
+ this.timeout(_timeout + 4000)
var entity = new UsergridEntity({
type: config.test.collection,