[OpenSRF-GIT] OpenSRF branch rel_3_0 updated. osrf_rel_3_0_1-2-gd2683cd

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, rel_3_0 has been updated
       via  d2683cd6d552fdbc6dc25e24cc2aa6c047243b4c (commit)
      from  0df7943369cbd5416276de84b428cd0a27a2b1eb (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 d2683cd6d552fdbc6dc25e24cc2aa6c047243b4c
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