loleaflet/src/core/Socket.js |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit b648d82316da01e8d1b2a32e0679ddad6caf6e11
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Thu Apr 12 16:30:32 2018 +0200

    loleaflet: More friendly message when the websocket creation goes wrong.
    
    Change-Id: Iaf7be5895c7baede7d72114dea9fb93550ccac7e
    Reviewed-on: https://gerrit.libreoffice.org/52784
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index ad654fc57..7bd33617a 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -32,10 +32,13 @@ L.Socket = L.Class.extend({
                        wopiSrc = '?WOPISrc=' + map.options.wopiSrc + 
'&compat=/ws';
                }
 
+               var websocketURI = map.options.server + '/lool/' + 
encodeURIComponent(map.options.doc + '?' + $.param(map.options.docParams)) + 
'/ws' + wopiSrc;
                try {
-                       this.socket = new WebSocket(map.options.server + 
'/lool/' + encodeURIComponent(map.options.doc + '?' + 
$.param(map.options.docParams)) + '/ws' + wopiSrc);
+                       this.socket = new WebSocket(websocketURI);
                } catch (e) {
-                       this._map.fire('error', {msg: _('Oops, there is a 
problem connecting to LibreOffice Online : ').replace('LibreOffice Online', 
(typeof brandProductName !== 'undefined' ? brandProductName : 'LibreOffice 
Online')) + e, cmd: 'socket', kind: 'failed', id: 3});
+                       this._map.fire('error', {msg: _('Oops, there is a 
problem connecting to LibreOffice Online : ').replace('LibreOffice Online', 
(typeof brandProductName !== 'undefined' ? brandProductName : 'LibreOffice 
Online')) + _('Cannot create websocket, please restart your browser.'), cmd: 
'socket', kind: 'failed', id: 3});
+                       console.log('Failed to create websocket: ' + 
websocketURI);
+                       console.log('Due to an exception: ' + e);
                        return;
                }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to