mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-08 15:59:16 +00:00
handle error messages
This commit is contained in:
@@ -5,6 +5,9 @@ const initiateOSC = (config) => {
|
|||||||
console.log(`OSC Server is listening on port ${config.port}`);
|
console.log(`OSC Server is listening on port ${config.port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// error
|
||||||
|
oscServer.on('error', console.error);
|
||||||
|
|
||||||
oscServer.on('message', function (msg) {
|
oscServer.on('message', function (msg) {
|
||||||
// message should look like /ontime/{path}/{args} where
|
// message should look like /ontime/{path}/{args} where
|
||||||
// ontime: fixed message for app
|
// ontime: fixed message for app
|
||||||
@@ -62,8 +65,8 @@ const initiateOSC = (config) => {
|
|||||||
console.log('calling goto with', args);
|
console.log('calling goto with', args);
|
||||||
try {
|
try {
|
||||||
let eventIndex = parseInt(args);
|
let eventIndex = parseInt(args);
|
||||||
if (isNaN(eventIndex) || eventIndex <= 0) return;
|
if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null)
|
||||||
global.timer.pause();
|
return;
|
||||||
global.timer.loadEvent(eventIndex - 1, undefined, true);
|
global.timer.loadEvent(eventIndex - 1, undefined, true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error calling goto: ', error);
|
console.log('error calling goto: ', error);
|
||||||
@@ -71,6 +74,7 @@ const initiateOSC = (config) => {
|
|||||||
break;
|
break;
|
||||||
case 'gotoid':
|
case 'gotoid':
|
||||||
console.log('calling gotoid with', args);
|
console.log('calling gotoid with', args);
|
||||||
|
if (args == null) return;
|
||||||
try {
|
try {
|
||||||
global.timer.loadEventById(args.toString().toLowerCase());
|
global.timer.loadEventById(args.toString().toLowerCase());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user