remnants of some troubleshooting; useful to keep these in here
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 7 Oct 2009 15:34:41 +0000 (15:34 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 7 Oct 2009 15:34:41 +0000 (15:34 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14290 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
Open-ILS/xul/staff_client/chrome/content/util/error.js
Open-ILS/xul/staff_client/chrome/content/util/network.js

index 57a3e2b..17b5dae 100644 (file)
@@ -3,8 +3,13 @@ dump('entering OpenILS/data.js\n');
 if (typeof OpenILS == 'undefined') OpenILS = {};
 OpenILS.data = function () {
 
-       JSAN.use('util.error'); this.error = new util.error();
-       JSAN.use('util.network'); this.network = new util.network();
+    try {
+        JSAN.use('util.error'); this.error = new util.error();
+        JSAN.use('util.network'); this.network = new util.network();
+    } catch(E) {
+        alert(location.href + '\nError in OpenILS.data constructor: ' + E);
+        throw(E);
+    }
 
        return this;
 }
index 734f424..04bec66 100644 (file)
@@ -1,21 +1,34 @@
        function $(id) { return document.getElementById(id); }
 
-       function ses(a) {
-               JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
-               switch(a) {
-            case 'staff_id' : return data.list.au[0].id(); break;
-            case 'staff_usrname' : return data.list.au[0].usrname(); break;
-            case 'ws_ou' :
-                return data.list.au[0].ws_ou();
-            break;
-                       case 'authtime' :
-                               return data.session.authtime;
-                       break;
-                       case 'key':
-                       default:
-                               return data.session.key;
-                       break;
-               }
+       function ses(a,params) {
+        try {
+            if (!params) params = {};
+            var data;
+            if (params.data) {
+                data = params.data; data.stash_retrieve();
+            } else {
+                // This has been breaking in certain contexts, with an internal instantiation of util.error failing because of util.error being an object instead of the constructor function it should be
+                JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+            }
+
+            switch(a) {
+                case 'staff_id' : return data.list.au[0].id(); break;
+                case 'staff_usrname' : return data.list.au[0].usrname(); break;
+                case 'ws_ou' :
+                    return data.list.au[0].ws_ou();
+                break;
+                case 'authtime' :
+                    return data.session.authtime;
+                break;
+                case 'key':
+                default:
+                    return data.session.key;
+                break;
+            }
+        } catch(E) {
+            alert(location.href + '\nError in global_utils.js, ses(): ' + E);
+            throw(E);
+        }
        }
 
        function font_helper() {
index 758b155..3c23d8f 100644 (file)
@@ -3,20 +3,26 @@ dump('entering util/error.js\n');
 if (typeof util == 'undefined') util = {};
 util.error = function () {
 
-       try {
-               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-               this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
-                       .getService(Components.interfaces.nsIConsoleService);
-       } catch(E) {
-               this.consoleDump = false;
-               dump('util.error constructor: ' + E + '\n');
-       }
+    try {
+
+        try {
+            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+            this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
+                .getService(Components.interfaces.nsIConsoleService);
+        } catch(E) {
+            this.consoleDump = false;
+            dump('util.error constructor: ' + E + '\n');
+        }
+
+        this.sdump_last_time = new Date();
 
-       this.sdump_last_time = new Date();
+        this.OpenILS = {};
 
-       this.OpenILS = {};
+        JSAN.use('util.sound'); this.sound = new util.sound();
 
-       JSAN.use('util.sound'); this.sound = new util.sound();
+    } catch(E) {
+        alert('Error in util.error constructor: ' + E);
+    }
 
        return this;
 };
index 9a4dbc9..e3f77fd 100644 (file)
@@ -6,10 +6,17 @@ var offlineStrings;
 if (typeof util == 'undefined') util = {};
 util.network = function () {
 
-       JSAN.use('util.error'); this.error = new util.error();
-       JSAN.use('util.sound'); this.sound = new util.sound();
+    try {
 
-    offlineStrings = document.getElementById('offlineStrings');
+        JSAN.use('util.error'); this.error = new util.error();
+        JSAN.use('util.sound'); this.sound = new util.sound();
+
+        offlineStrings = document.getElementById('offlineStrings');
+
+    } catch(E) {
+        alert('error in util.network constructor: ' + E);
+        throw(E);
+    }
 
        return this;
 };