From 64f40de0627d9c31b40b022e2175f598bbb6b21e Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 14 May 2014 12:51:29 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20error=20on=20JSON=20parse=20err?= =?UTF-8?q?or?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It should be up to the caller to decide if a non-JSON body is actually an error state. For example: you make a request where you expect a JSON response, but instead you get 204 No Content. It should be up to your application to decide what that means. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1a77c6f..ea33518 100644 --- a/index.js +++ b/index.js @@ -271,7 +271,7 @@ function run_xhr(options) { xhr.body = xhr.responseText if(options.json) { try { xhr.body = JSON.parse(xhr.responseText) } - catch (er) { return options.callback(er, xhr) } + catch (e) { } } options.callback(null, xhr, xhr.body)