[OpenSRF-GIT] OpenSRF branch master updated. 705599ff6aa29857e8ed1b3da11e6e8ba05e9aa9

Evergreen Git git at git.evergreen-ils.org
Mon Nov 5 10:44:57 EST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, master has been updated
       via  705599ff6aa29857e8ed1b3da11e6e8ba05e9aa9 (commit)
      from  884e00c41abd33ed8785acc1bc5958fd027a0807 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 705599ff6aa29857e8ed1b3da11e6e8ba05e9aa9
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Jun 12 12:12:45 2018 -0400

    LP#1776510 JS libs handle transport errors
    
    Teach the websocket client code to look for the transport_error flag
    applied to the websocket wrapper message by the websocket gateway when a
    request for an unavilable service is made.
    
    When encountered, fire the transport or generic error handler callbacks,
    if available.  Avoid any attempts to further process the message.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/src/javascript/opensrf.js b/src/javascript/opensrf.js
index 394cddd..e18efa5 100644
--- a/src/javascript/opensrf.js
+++ b/src/javascript/opensrf.js
@@ -361,6 +361,29 @@ OpenSRF.Session.prototype.setup_single_ws = function() {
                 "Error parsing JSON in shared WS response: " + msg);
             throw E;
         }
+
+        if (msg.transport_error) {
+            // Websockets gateway returns bounced messages (e.g. for
+            // requets to unavailable services) with a transport_error
+            // flag set.  
+            console.error(
+                'Websocket request failed with a transport error', msg);
+
+            var ses = OpenSRF.Session.find_session(msg.thread); 
+            if (ses) {
+                if (msg.osrf_msg && msg.osrf_msg[0]) {
+                    var req = ses.find_request(msg.osrf_msg[0].threadTrace());
+                    if (req) {
+                        var handler = req.ontransporterror || req.onerror;
+                        if (handler) {
+                            handler('Service ' + ses.service + ' unavailable');
+                        }
+                    }
+                }
+            }
+            return; // No viable error handlers
+        }
+
         OpenSRF.Stack.push(                                                        
             new OpenSRF.NetMessage(                                                
                null, null, msg.thread, null, msg.osrf_msg)                        

-----------------------------------------------------------------------

Summary of changes:
 src/javascript/opensrf.js |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list