loleaflet: More friendly message when the websocket creation goes wrong.
Change-Id: Iaf7be5895c7baede7d72114dea9fb93550ccac7e Reviewed-on: https://gerrit.libreoffice.org/53218 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
This commit is contained in:
parent
2bac7784b4
commit
29bb6be15b
1 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue