LP#1755258 Improve network error handling
authorBill Erickson <berickxx@gmail.com>
Tue, 12 Jun 2018 16:01:15 +0000 (12:01 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 5 Sep 2018 21:59:16 +0000 (17:59 -0400)
Improve promise handling and logging in browser client network request
failure handling.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/services/net.js

index 26eb31c..8415dc5 100644 (file)
@@ -111,13 +111,16 @@ function($q,  $rootScope,  egEvent) {
                 // bother JSON-ifying it, since there is the off
                 // chance that JSON-ification could fail, e.g if 
                 // the object has circular refs.
-                console.error(request.method + 
-                    ' (' + request.params + ')  failed.  See server logs.');
-                deferred.reject(msg);
+                var note = request.method + 
+                    ' (' + request.params + ')  failed.  See server logs.';
+                console.error(note, msg);
+                request.deferred.reject(note);
             },
             onmethoderror : function(req, statCode, statMsg) { 
-                console.error('error calling method ' + 
-                    request.method + ' : ' + statCode + ' : ' + statMsg);
+                var msg = 'error calling method ' + 
+                    request.method + ' : ' + statCode + ' : ' + statMsg;
+                console.error(msg);
+                request.deferred.reject(msg);
             }
 
         }).send();