mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
electron-130: fixes the issue raised
This commit is contained in:
parent
fa2c96cfbd
commit
e74d4c11d4
@ -12,8 +12,9 @@ const logLevels = require('../enums/logLevels.js');
|
|||||||
* @param {String} errorDesc Description of error
|
* @param {String} errorDesc Description of error
|
||||||
* @param {Number} errorCode Error code
|
* @param {Number} errorCode Error code
|
||||||
* @param {function} retryCallback Callback when user clicks reload
|
* @param {function} retryCallback Callback when user clicks reload
|
||||||
|
* @param {Boolean} showDialog Indicates if a dialog need to be show to a user
|
||||||
*/
|
*/
|
||||||
function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
function showLoadFailure(win, url, errorDesc, errorCode, retryCallback, showDialog) {
|
||||||
let msg;
|
let msg;
|
||||||
if (url) {
|
if (url) {
|
||||||
msg = 'Error loading URL:\n' + url;
|
msg = 'Error loading URL:\n' + url;
|
||||||
@ -27,16 +28,18 @@ function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
|||||||
msg += '\n\nError Code: ' + errorCode;
|
msg += '\n\nError Code: ' + errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
electron.dialog.showMessageBox(win, {
|
if (showDialog) {
|
||||||
type: 'error',
|
electron.dialog.showMessageBox(win, {
|
||||||
buttons: ['Reload', 'Ignore'],
|
type: 'error',
|
||||||
defaultId: 0,
|
buttons: ['Reload', 'Ignore'],
|
||||||
cancelId: 1,
|
defaultId: 0,
|
||||||
noLink: true,
|
cancelId: 1,
|
||||||
title: 'Loading Error',
|
noLink: true,
|
||||||
message: msg
|
title: 'Loading Error',
|
||||||
}, response);
|
message: msg
|
||||||
|
}, response);
|
||||||
|
}
|
||||||
|
|
||||||
log.send(logLevels.WARNING, 'Load failure msg: ' + errorDesc +
|
log.send(logLevels.WARNING, 'Load failure msg: ' + errorDesc +
|
||||||
' errorCode: ' + errorCode + ' for url:' + url);
|
' errorCode: ' + errorCode + ' for url:' + url);
|
||||||
|
|
||||||
@ -57,7 +60,7 @@ function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
|||||||
*/
|
*/
|
||||||
function showNetworkConnectivityError(win, url, retryCallback) {
|
function showNetworkConnectivityError(win, url, retryCallback) {
|
||||||
let errorDesc = 'Network connectivity has been lost, check your internet connection.';
|
let errorDesc = 'Network connectivity has been lost, check your internet connection.';
|
||||||
showLoadFailure(win, url, errorDesc, 0, retryCallback);
|
showLoadFailure(win, url, errorDesc, 0, retryCallback, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { showLoadFailure, showNetworkConnectivityError };
|
module.exports = { showLoadFailure, showNetworkConnectivityError };
|
@ -177,7 +177,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
|
|
||||||
mainWindow.webContents.on('did-fail-load', function (event, errorCode,
|
mainWindow.webContents.on('did-fail-load', function (event, errorCode,
|
||||||
errorDesc, validatedURL) {
|
errorDesc, validatedURL) {
|
||||||
loadErrors.showLoadFailure(mainWindow, validatedURL, errorDesc, errorCode, retry);
|
loadErrors.showLoadFailure(mainWindow, validatedURL, errorDesc, errorCode, retry, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
addWindowKey(key, mainWindow);
|
addWindowKey(key, mainWindow);
|
||||||
|
Loading…
Reference in New Issue
Block a user