more graceful handling of errors during login sequence
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jan 2009 00:38:50 +0000 (00:38 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jan 2009 00:38:50 +0000 (00:38 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11957 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/server/main/data.xul

index 9cb5c9c..1a60bed 100644 (file)
@@ -778,12 +778,12 @@ OpenILS.data.prototype = {
                this.exec.on_error = function(E) { 
                
                        if (typeof obj.on_error == 'function') {
-                               obj.on_error();
+                               return obj.on_error(E); /* false breaks chain */
                        } else {
                                alert('oops: ' + E ); 
+                           return false; /* break chain */
                        }
 
-                       return false; /* break chain */
                }
 
                this.exec.chain( this.chain );
index e77a122..7092b69 100644 (file)
 
                        // ----
 
+            JSAN.use('util.error'); 
+            g.error = new util.error();
                        JSAN.use('OpenILS.data');
                        g.data = new OpenILS.data()
-                       g.data.on_error = xulG.auth.logoff;
 
                        g.data.session = {};
                        g.data.session.key = xulG.auth.session.key;
                        g.data.session.authtime = xulG.auth.session.authtime;
                        g.data.stash('session');
+            g.data.on_error = function(E) {
+                try {
+                    g.error.standard_unexpected_error_alert('Error during login sequence.  The client will logout after this dialog.',E);
+                    setTimeout(
+                        function() {
+                            try {
+                                xulG.auth.logoff();
+                            } catch(E3) {
+                                alert(E3);
+                            }
+                        }, 0
+                    );
+                } catch(E2) {
+                    alert(E2);
+                    try { xulG.auth.logoff(); } catch(E4) { alert(E4); };
+                }
+                return false;
+            }
                        g.data.on_complete = function () {
 
                 try {