osc/custom module: more error backtraces
This commit is contained in:
parent
71182cfd2e
commit
33d0b54dad
4 changed files with 27 additions and 8 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 1.26.3
|
||||
|
||||
- custom module
|
||||
- provide error backtraces in module.exports functions
|
||||
|
||||
## 1.26.2
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class CustomModule {
|
|||
try {
|
||||
code = fs.readFileSync(this.filename, {encoding: 'utf8', flag: 'rs'}) // flag 'rs' to avoid cache issue on windows
|
||||
} catch(err) {
|
||||
console.error(`(ERROR) ${this.submodule ? 'Submodule' : 'Custom module'} not found: ${this.filename}`)
|
||||
console.error(`(ERROR, CUSTOM MODULE) module not found: ${this.filename}`)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +129,8 @@ class CustomModule {
|
|||
})
|
||||
} catch(err) {
|
||||
loadedModules[this.filename] = null
|
||||
console.error('(ERROR) Custom module loading error')
|
||||
console.error(err)
|
||||
console.error('(ERROR, CUSTOM MODULE) error while loading module')
|
||||
console.log(err)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ class CustomModule {
|
|||
try {
|
||||
this.module.exports.unload()
|
||||
} catch(e) {
|
||||
console.error('(ERROR) Error while unloading custom module')
|
||||
console.error('(ERROR) Error while unloading custom module', e)
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,14 +145,24 @@ class OscServer {
|
|||
|
||||
oscInFilter(data){
|
||||
if (this.customModule.oscInFilter) {
|
||||
return this.customModule.oscInFilter(data)
|
||||
try {
|
||||
return this.customModule.oscInFilter(data)
|
||||
} catch(e) {
|
||||
console.error('(ERROR, CUSTOM MODULE)', e)
|
||||
return data
|
||||
}
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
oscOutFilter(data){
|
||||
if (this.customModule.oscOutFilter) {
|
||||
return this.customModule.oscOutFilter(data)
|
||||
try {
|
||||
return this.customModule.oscOutFilter(data)
|
||||
} catch(e) {
|
||||
console.error('(ERROR, CUSTOM MODULE)', e)
|
||||
return data
|
||||
}
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
|
|
@ -198,7 +208,11 @@ class OscServer {
|
|||
}
|
||||
|
||||
if (this.customModule.init) {
|
||||
this.customModule.init()
|
||||
try {
|
||||
this.customModule.init()
|
||||
} catch(e) {
|
||||
console.error('(ERROR, CUSTOM MODULE)', e)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class OscTCPClient extends EventEmitter {
|
|||
this.port = new osc.TCPSocketPort(this.options)
|
||||
|
||||
this.port.on('error', (err)=>{
|
||||
console.error(`(ERROR, TCP) ${err.message}`)
|
||||
console.error('(ERROR, TCP)', err)
|
||||
})
|
||||
|
||||
this.port.on('close', (hadErr)=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue