Skip to content
Browse files

Support invalid JSON

  • Loading branch information...
1 parent 8e185ff commit dfac5a8cf251077a5a38f4ed40b75cb2bb969157 @jhs jhs committed Feb 21, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 probe_couchdb.js
View
7 probe_couchdb.js
@@ -184,8 +184,11 @@ Couch.prototype.request = function request_wrapper(opts, callback) {
var self = this;
function json_body(er, resp, body) {
- if(!er)
- body = JSON.parse(body);
+ if(!er) {
+ try { body = JSON.parse(body) }
+ catch(e) { er = e }
+ }
+
return callback && callback.apply(this, [er, resp, body]);
}

0 comments on commit dfac5a8

Please sign in to comment.
Something went wrong with that request. Please try again.