[OpenSRF-GIT] OpenSRF branch rel_2_5 updated. osrf_rel_2_5_2-3-gec9f1a7

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_2_5 has been updated
       via  ec9f1a709c6f9a083dd25d01edb6eedc84dea556 (commit)
      from  a8111283c54856c364342fcf739164b55bfda7ca (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 ec9f1a709c6f9a083dd25d01edb6eedc84dea556
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