error handling, launcher ui, read-only mode, rm plot/smooth

This commit is contained in:
bordun 2020-03-09 19:12:43 +01:00
parent cee4cb81b7
commit 4f31985930
59 changed files with 1299 additions and 781 deletions

View file

@ -36,7 +36,7 @@ class OscServer {
try {
return fs.readFileSync(customModule[0], 'utf8')
} catch(err) {
console.log('CustomModule Error: File not found: ' + customModule[0])
console.log('(ERROR) Custom module not found: ' + customModule[0])
return false
}
})(),
@ -64,11 +64,11 @@ class OscServer {
url = path.resolve(path.dirname(customModule[0]), url)
return JSON.parse(fs.readFileSync(url, 'utf8'))
} catch(e) {
console.error('ERROR: could not load json file from ' + url)
console.error('(ERROR) could not load json file from ' + url)
console.error(e.message)
}
} else {
console.error('ERROR: unauthorized file type for loadJSON')
console.error('(ERROR) unauthorized file type for loadJSON')
}
},
saveJSON: (url, data)=>{
@ -77,11 +77,11 @@ class OscServer {
try {
return fs.writeFileSync(url, JSON.stringify(data, null, ' '))
} catch(e) {
console.error('ERROR: could not save json file to ' + url)
console.error('(ERROR) could not save json file to ' + url)
console.error(e.message)
}
} else {
console.error('ERROR: unauthorized file type for saveJSON')
console.error('(ERROR) unauthorized file type for saveJSON')
}
},
app: this.customModuleEventEmitter,
@ -164,7 +164,7 @@ class OscServer {
} else {
if (typeof data.address !== 'string' || data.address[0] !== '/') {
console.error('OSC error: malformed address: "' + data.address + '')
console.error('(ERROR, OSC) Malformed address: ' + data.address)
return
}
@ -184,7 +184,7 @@ class OscServer {
}
if (debug) console.log('OSC sent: ',{address:data.address, args: data.args}, 'To: ' + data.host + ':' + data.port)
if (debug) console.log('(OSC) Out: ',{address:data.address, args: data.args}, 'To: ' + data.host + ':' + data.port)
}
@ -203,7 +203,7 @@ class OscServer {
ipc.send('receiveOsc',data)
if (debug) console.log('OSC received: ', {address:data.address, args: data.args}, 'From: ' + data.host + ':' + data.port)
if (debug) console.log('(OSC) In: ', {address:data.address, args: data.args}, 'From: ' + data.host + ':' + data.port)
}

View file

@ -25,13 +25,13 @@ class OscTCPClient extends EventEmitter {
this.port = new osc.TCPSocketPort(this.options)
this.port.on('error', (err)=>{
console.error(`TCP: Error: ${err.message}`)
console.error(`(ERROR, TCP) ${err.message}`)
})
this.port.on('close', (hadErr)=>{
console.log(`TCP: connection closed (${this.remoteAddress}:${this.remotePort})`)
console.log(`(TCP) Connection closed (${this.remoteAddress}:${this.remotePort})`)
if (!this.options.socket) {
console.log(`TCP: attempting reconnection in 5s (${this.remoteAddress}:${this.remotePort})`)
console.log(`(TCP) Attempting reconnection in 5s (${this.remoteAddress}:${this.remotePort})`)
this.reconnect()
} else {
this.emit('die')
@ -43,7 +43,7 @@ class OscTCPClient extends EventEmitter {
})
this.port.on('ready', ()=>{
console.log(`TCP: connection established (${this.remoteAddress}:${this.remotePort})`)
console.log(`(TCP) Connection established (${this.remoteAddress}:${this.remotePort})`)
})
if (!this.options.socket) {

View file

@ -10,8 +10,12 @@ var oscUDPServer = new osc.UDPPort({
broadcast: true
})
oscUDPServer.on('error', function(error) {
console.error(error)
oscUDPServer.on('error', function(e) {
if (e.code === 'EADDRINUSE') {
console.error(`(ERROR, UDP) could not open port ${oscInPort} (already in use) `)
} else {
console.error(`(ERROR, UDP) ${e.message}`)
}
})
zeroconf.publish({
@ -19,8 +23,6 @@ zeroconf.publish({
protocol: 'udp',
type: 'osc',
port: oscInPort
}).on('error', (e)=>{
console.error(`Error: Zeroconf: ${e.message}`)
})
module.exports = oscUDPServer