add some more trycatch for external code calls

This commit is contained in:
Jiiks 2018-01-21 01:46:49 +02:00
parent 6640fa1890
commit 4362d39624
1 changed files with 10 additions and 2 deletions

View File

@ -191,13 +191,21 @@ class PluginManager extends Module {
stopPlugin(name) { stopPlugin(name) {
const plugin = this.getPluginByName(name); const plugin = this.getPluginByName(name);
try {
if (plugin && plugin.instance) return plugin.instance.stop(); if (plugin && plugin.instance) return plugin.instance.stop();
} catch (err) {
Logger.err('PluginManager', err);
}
return true; //Return true anyways since plugin doesn't exist return true; //Return true anyways since plugin doesn't exist
} }
startPlugin(name) { startPlugin(name) {
const plugin = this.getPluginByName(name); const plugin = this.getPluginByName(name);
try {
if (plugin && plugin.instance) return plugin.instance.start(); if (plugin && plugin.instance) return plugin.instance.start();
} catch (err) {
Logger.err('PluginManager', err);
}
return true; //Return true anyways since plugin doesn't exist return true; //Return true anyways since plugin doesn't exist
} }