From 9314594051ca772aca0627cc9d1a5dd6fc46b51d Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Thu, 27 May 2021 15:01:34 +0200 Subject: [PATCH] handle error messages --- server/controllers/OscController.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/controllers/OscController.js b/server/controllers/OscController.js index dba6d9cc1..e4ddcb983 100644 --- a/server/controllers/OscController.js +++ b/server/controllers/OscController.js @@ -5,6 +5,9 @@ const initiateOSC = (config) => { console.log(`OSC Server is listening on port ${config.port}`); }); + // error + oscServer.on('error', console.error); + oscServer.on('message', function (msg) { // message should look like /ontime/{path}/{args} where // ontime: fixed message for app @@ -62,8 +65,8 @@ const initiateOSC = (config) => { console.log('calling goto with', args); try { let eventIndex = parseInt(args); - if (isNaN(eventIndex) || eventIndex <= 0) return; - global.timer.pause(); + if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null) + return; global.timer.loadEvent(eventIndex - 1, undefined, true); } catch (error) { console.log('error calling goto: ', error); @@ -71,6 +74,7 @@ const initiateOSC = (config) => { break; case 'gotoid': console.log('calling gotoid with', args); + if (args == null) return; try { global.timer.loadEventById(args.toString().toLowerCase()); } catch (error) {