[cubicweb.js] log evalJSON errors (closes #1947473) stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 22 Sep 2011 16:53:46 +0200
branchstable
changeset 7831 6af00dbfaadd
parent 7830 37d23a1d3547
child 7832 953f224357af
[cubicweb.js] log evalJSON errors (closes #1947473)
web/data/cubicweb.js
--- a/web/data/cubicweb.js	Thu Sep 22 16:53:43 2011 +0200
+++ b/web/data/cubicweb.js	Thu Sep 22 16:53:46 2011 +0200
@@ -53,7 +53,13 @@
     },
 
     evalJSON: function (json) { // trust source
-        return eval("(" + json + ")");
+        try {
+            return eval("(" + json + ")");
+        } catch(e) {
+          cw.log(e);
+          cw.log('The faulty json source was', json);
+          throw (e);
+       }
     },
 
     urlEncode: function (str) {