basically reverted back - left the try catch
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 18 Jul 2005 18:03:08 +0000 (18:03 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 18 Jul 2005 18:03:08 +0000 (18:03 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@403 9efc2488-bf62-4759-914b-345cdb29e865

src/javascript/JSON.js

index 7511f32..6994cfc 100644 (file)
@@ -41,10 +41,20 @@ function object2Array(obj) {
        return arr;
 }
 
+
 function js2JSON(arg) {
+       try { 
+               return _js2JSON(arg);
+       } catch(E) {
+               //alert(E + "EX");
+               if(arg && arg.toString) return arg.toString();
+               return arg;
+       }
+}
+
+function _js2JSON(arg) {
        var i, o, u, v;
 
-       try {
                switch (typeof arg) {
                        case 'object':
        
@@ -127,8 +137,5 @@ function js2JSON(arg) {
                        default:
                                return '"' + String(arg).replace(/(["\\])/g, '\\$1') + '"';
                }
-       } catch(E) {
-               if(arg && arg.toString) return arg.toString();
-               return arg;
-       }
+
 }