Skip to content

Commit

Permalink
bugfix/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdadams committed Feb 13, 2024
1 parent 532172d commit ce041af
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
55 changes: 32 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,20 +443,25 @@ function propresenter_connect() {
});

propresenter_socket.on('error', function (err) {
if (err.errno !== undefined){
if (err.errno.indexOf('ECONNREFUSED') > -1) {
propresenter_status = 'econnrefused';
SendStatusMessage();
trayMenuItems[0].label = 'Connection Refused: ' + ip + ':' + port;
buildTray();
}
else if (err.errno.indexOf('ETIMEDOUT') > -1) {
propresenter_status = 'etimedout';
SendStatusMessage();
trayMenuItems[0].label = 'Connection Timed Out: ' + ip + ':' + port;
buildTray();
try {
if (err.errno !== undefined) {
if (err.errno.indexOf('ECONNREFUSED') > -1) {
propresenter_status = 'econnrefused';
SendStatusMessage();
trayMenuItems[0].label = 'Connection Refused: ' + ip + ':' + port;
buildTray();
}
else if (err.errno.indexOf('ETIMEDOUT') > -1) {
propresenter_status = 'etimedout';
SendStatusMessage();
trayMenuItems[0].label = 'Connection Timed Out: ' + ip + ':' + port;
buildTray();
}
}
}
catch(error) {

}
});

propresenter_socket.on('close', function(code, reason) {
Expand Down Expand Up @@ -543,18 +548,22 @@ function presentationbridge_connect() {
});

bridgeIO.on('error', function (err) {
console.log('Bridge Connect Error')
if (err.errno.indexOf('ECONNREFUSED') > -1) {
presentationbridge_status = 'econnrefused';
SendStatusMessage();
trayMenuItems[1].label = 'Connection Refused: ' + ip + ':' + port;
buildTray();
try {
if (err.errno.indexOf('ECONNREFUSED') > -1) {
presentationbridge_status = 'econnrefused';
SendStatusMessage();
trayMenuItems[1].label = 'Connection Refused: ' + ip + ':' + port;
buildTray();
}
else if (err.errno.indexOf('ETIMEDOUT') > -1) {
presentationbridge_status = 'etimedout';
SendStatusMessage();
trayMenuItems[1].label = 'Connection Timed Out: ' + ip + ':' + port;
buildTray();
}
}
else if (err.errno.indexOf('ETIMEDOUT') > -1) {
presentationbridge_status = 'etimedout';
SendStatusMessage();
trayMenuItems[1].label = 'Connection Timed Out: ' + ip + ':' + port;
buildTray();
catch(error) {

}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "presentationbridge-client",
"productName": "PresentationBridge Client",
"version": "1.0.18",
"version": "1.0.19",
"description": "Links data from your Presentation / lyrics software to other software.",
"license": "MIT",
"repository": "josephdadams/presentationbridge-client",
Expand Down

0 comments on commit ce041af

Please sign in to comment.