improve error message on invalid WOPI host
- before this patch when socket connection failed, we used to show the same error for socket connection failure and send the 'Action_Load_Resp' with same errorMsg - now we show/send different message for unauthorized and loading failure Signed-off-by: Rash419 <rashesh.padia@collabora.com> Change-Id: I71b1b7f8e2eca93790d068583370787825911a41
This commit is contained in:
parent
a4add51e93
commit
d4918c7998
2 changed files with 26 additions and 6 deletions
|
@ -1542,17 +1542,36 @@ app.definitions.Socket = L.Class.extend({
|
|||
// Let onclose (_onSocketClose) report errors.
|
||||
},
|
||||
|
||||
_onSocketClose: function () {
|
||||
_onSocketClose: function (event) {
|
||||
window.app.console.debug('_onSocketClose:');
|
||||
if (!this._map._docLoadedOnce && this.ReconnectCount === 0) {
|
||||
var errorMsg, errorType = '';
|
||||
var reason = event.reason;
|
||||
if (reason && reason.startsWith('error:')) {
|
||||
var command = this.parseServerCmd(reason);
|
||||
if (command.errorCmd === 'internal' && command.errorKind === 'unauthorized') {
|
||||
errorType = 'websocketunauthorized';
|
||||
errorMsg = errorMessages.unauthorized;
|
||||
} else if (command.errorCmd === 'storage' && command.errorKind === 'loadfailed') {
|
||||
errorType = 'websocketloadfailed';
|
||||
errorMsg = errorMessages.storage.loadfailed;
|
||||
} else {
|
||||
errorType = 'websocketgenericfailure';
|
||||
errorMsg = errorMessages.websocketgenericfailure;
|
||||
}
|
||||
} else {
|
||||
errorType = 'websocketproxyfailure';
|
||||
errorMsg = errorMessages.websocketproxyfailure;
|
||||
}
|
||||
this._map.fire('error', { msg: errorMsg, cmd: 'socket', kind: 'closed', id: 4 });
|
||||
var postMessageObj = {
|
||||
errorType: 'websocketconnectionfailed',
|
||||
errorType: errorType,
|
||||
success: false,
|
||||
errorMsg: errorMessages.websocketconnectionfailed,
|
||||
errorMsg: errorMsg,
|
||||
result: '',
|
||||
};
|
||||
this._map.fire('postMessage', {msgId: 'Action_Load_Resp', args: postMessageObj});
|
||||
this._map.fire('error', {msg: errorMessages.websocketconnectionfailed, cmd: 'socket', kind: 'closed', id: 4});
|
||||
this._map.fire('postMessage', { msgId: 'Action_Load_Resp', args: postMessageObj });
|
||||
return;
|
||||
}
|
||||
if (this.ReconnectCount > 0)
|
||||
return;
|
||||
|
|
|
@ -36,7 +36,8 @@ errorMessages.docloadtimeout = _('Failed to load the document. This document is
|
|||
errorMessages.docunloadingretry = _('Cleaning up the document from the last session.');
|
||||
errorMessages.docunloadinggiveup = _('We are in the process of cleaning up this document from the last session, please try again later.');
|
||||
errorMessages.clusterconfiguration = _('Your %productName cluster appear to be mis-configured or scaling rapidly - please contact your system administrator. Continuing with editing may result in multiple users not seeing each other, conflicts in the document storage and/or copy/paste problems. Expected serverId %0 for routeToken %1 but connected to serverId %2');
|
||||
errorMessages.websocketconnectionfailed = _('Failed to establish socket connection or socket connection closed unexpectedly. The reverse proxy might be misconfigured, please contact the administrator. For more info on proxy configuration please checkout https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html');
|
||||
errorMessages.websocketproxyfailure = _('Failed to establish socket connection or socket connection closed unexpectedly. The reverse proxy might be misconfigured, please contact the administrator. For more info on proxy configuration please checkout https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html');
|
||||
errorMessages.websocketgenericfailure = _('Failed to establish socket connection or socket connection closed unexpectedly.');
|
||||
if (window.ThisIsAMobileApp) {
|
||||
errorMessages.storage = {
|
||||
loadfailed: _('Failed to load document.'),
|
||||
|
|
Loading…
Reference in a new issue