[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/src

Jan Holesovsky kendy at collabora.com
Thu Apr 26 17:25:50 UTC 2018


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

New commits:
commit b648d82316da01e8d1b2a32e0679ddad6caf6e11
Author: Jan Holesovsky <kendy at 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.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at 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;
 		}
 


More information about the Libreoffice-commits mailing list