Skip to content

Commit

Permalink
- "Attempt"ing the decode, since weird responses could throw errors.
Browse files Browse the repository at this point in the history
 - Forgot to add ELSE.
  • Loading branch information
kamicane committed May 3, 2010
1 parent fc5f0cc commit 9aa3554
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/Request/Request.JSON.js
Expand Up @@ -28,9 +28,11 @@ Request.JSON = new Class({
},

success: function(text){
var json = this.response.json = JSON.decode(text, this.options.secure);
var json = this.response.json = Function.attempt(function(){
return JSON.decode(text, this.options.secure);
});
if (json == null) this.onFailure();
this.onSuccess(json, text);
else this.onSuccess(json, text);
}

});

0 comments on commit 9aa3554

Please sign in to comment.