From: Bill Erickson <berickxx@gmail.com>
Date: Tue, 12 Jun 2018 16:01:15 +0000 (-0400)
Subject: LP#1755258 Improve network error handling
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9266a76a9f11fcc419e38d99a114216b9266aef6;p=evergreen%2Fjoelewis.git

LP#1755258 Improve network error handling

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>
---

diff --git a/Open-ILS/web/js/ui/default/staff/services/net.js b/Open-ILS/web/js/ui/default/staff/services/net.js
index 26eb31c6dc..8415dc59e7 100644
--- a/Open-ILS/web/js/ui/default/staff/services/net.js
+++ b/Open-ILS/web/js/ui/default/staff/services/net.js
@@ -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();