Merge pull request #851 from matthijskooijman/custom-module-reload-function

custom-module: Call reload() function on auto-reload
This commit is contained in:
jean-emmanuel 2024-06-22 12:00:52 +02:00 • committed by GitHub
commit a21e789437
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 5 deletions

View file

@ -195,6 +195,15 @@ class CustomModule {
console.log('(INFO) Reloading custom module...')
if (this.load()) {
console.log('(INFO) Custom module reloaded successfully')
if (this.module.exports && this.module.exports.reload) {
try {
this.module.exports.reload()
} catch(e) {
console.error('(ERROR) Error while calling custom module reload function')
console.error(e)
}
}
} else {
console.error('(ERROR) Failed to reload custom module')
this.unload()