aboutsummaryrefslogtreecommitdiffstats
path: root/src/JSON.js
diff options
context:
space:
mode:
authorVojta Jina2012-03-07 12:17:48 -0800
committerVojta Jina2012-03-08 11:38:14 -0800
commitb348347dadfa0abe3442ff0bdbc52d8077621e95 (patch)
tree69a73d34aa2c8af83965c564413ffb965840d26a /src/JSON.js
parent512db03cc003c590a9dcd2b1ee1f3fb2cbad1b78 (diff)
downloadangular.js-b348347dadfa0abe3442ff0bdbc52d8077621e95.tar.bz2
refactor(fromJson): Remove error() and just throw
It's more likely you are using angular.fromJson() inside Angular world, which means you get proper exception handling by $exceptionHandler. There is no point to explicitly push it to console and it causes memory leaks on most browsers (tried Chrome stable/canary, Safari, FF).
Diffstat (limited to 'src/JSON.js')
-rw-r--r--src/JSON.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/JSON.js b/src/JSON.js
index db145879..983a53e8 100644
--- a/src/JSON.js
+++ b/src/JSON.js
@@ -37,17 +37,12 @@ function fromJson(json, useNative) {
var obj;
- try {
- if (useNative && window.JSON && window.JSON.parse) {
- obj = JSON.parse(json);
- } else {
- obj = parseJson(json, true)();
- }
- return transformDates(obj);
- } catch (e) {
- error("fromJson error: ", json, e);
- throw e;
+ if (useNative && window.JSON && window.JSON.parse) {
+ obj = JSON.parse(json);
+ } else {
+ obj = parseJson(json, true)();
}
+ return transformDates(obj);
// TODO make forEach optionally recursive and remove this function
// TODO(misko): remove this once the $http service is checked in.