Skip to content

Commit

Permalink
Update PR zulip#115 code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Lplenka committed Apr 27, 2017
1 parent d2daa65 commit 8ecdf1f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,20 @@ function checkConnectivity() {
}
});
}
const connectivityERR = [
'ERR_INTERNET_DISCONNECTED',
'ERR_PROXY_CONNECTION_FAILED',
'ERR_CONNECTION_RESET',
'ERR_NOT_CONNECTED',
'ERR_NAME_NOT_RESOLVED'
];

function checkConnection() {
// eslint-disable-next-line no-unused-vars
mainWindow.webContents.on('did-fail-load', (event, errorCode, errorDescription, validatedURL) => {
if (errorDescription === 'ERR_INTERNET_DISCONNECTED' || errorDescription === 'ERR_PROXY_CONNECTION_FAILED' || errorDescription === 'ERR_CONNECTION_RESET' || errorDescription === 'ERR_NAME_NOT_RESOLVED') {
console.log('Error Description:' + errorDescription);
const hasConnectivityErr = (connectivityERR.indexOf(errorDescription) >= 0);
if (hasConnectivityErr) {
console.error('error', errorDescription);
checkConnectivity();
}
});
Expand Down

0 comments on commit 8ecdf1f

Please sign in to comment.