Skip to content

Commit

Permalink
Revert "Request.JSON now catches errors thrown by JSON.decode and fir…
Browse files Browse the repository at this point in the history
…es the failure event." This is a new feature and therefore will have to wait until 2.0.

This reverts commit b14d56b.
  • Loading branch information
appden committed Sep 9, 2009
1 parent 55d5b7f commit db5a5af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 0 additions & 6 deletions Docs/Request/Request.JSON.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,3 @@ Fired when the request completes. This overrides the signature of the Request su
alert(person.height); //Alerts "170 cm".
alert(person.weight); //Alerts "120 kg".
}}).get({'firstName': 'John', 'lastName': 'Doe'});

### failure

Request.JSON fires the *failure* event when the JSON value is not parsed due to security tests. If the option for *secure* is set to true and the JSON value is *not* secure, [JSON.decode][] will throw an exception. Request.JSON catches this and fires its *failure* event.

[JSON.decode]: /core/docs/Utilities/JSON#JSON:decode
10 changes: 3 additions & 7 deletions Source/Request/Request.JSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ Request.JSON = new Class({
},

success: function(text){
try {
this.response.json = JSON.decode(text, this.options.secure);
this.onSuccess(this.response.json, text);
} catch(error) {
this.failure();
}
this.response.json = JSON.decode(text, this.options.secure);
this.onSuccess(this.response.json, text);
}

});
});

0 comments on commit db5a5af

Please sign in to comment.