Commit 6d379f36 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when plugin crash warning is printed in the console

parent a4e4b117
Pipeline #9987 failed with stage
in 32 minutes and 5 seconds
...@@ -588,12 +588,14 @@ function createProjectMap(options) { ...@@ -588,12 +588,14 @@ function createProjectMap(options) {
try { try {
return Promise.resolve(listenerWrapper(e)).catch(function (error) { return Promise.resolve(listenerWrapper(e)).catch(function (error) {
GuiConnector.warn("Plugin " + options.plugin.getName() + " crashed"); GuiConnector.warn("Plugin " + options.plugin.getName() + " crashed");
logger.warn(error);
if (typeof options.plugin.getLoadedPluginData().notifyError === "function") { if (typeof options.plugin.getLoadedPluginData().notifyError === "function") {
options.plugin.getLoadedPluginData().notifyError({listener: param, data: e, error: error}); options.plugin.getLoadedPluginData().notifyError({listener: param, data: e, error: error});
} }
}); });
} catch (error) { } catch (error) {
GuiConnector.warn("Plugin " + options.plugin.getName() + " crashed"); GuiConnector.warn("Plugin " + options.plugin.getName() + " crashed");
logger.warn(error);
if (typeof options.plugin.getLoadedPluginData().notifyError === "function") { if (typeof options.plugin.getLoadedPluginData().notifyError === "function") {
options.plugin.getLoadedPluginData().notifyError({listener: param, data: e, error: error}); options.plugin.getLoadedPluginData().notifyError({listener: param, data: e, error: error});
} }
......
...@@ -114,7 +114,7 @@ describe('Plugin', function () { ...@@ -114,7 +114,7 @@ describe('Plugin', function () {
return plugin.load().then(function () { return plugin.load().then(function () {
return map.callListeners("onCenterChanged", new Point(0, 0)); return map.callListeners("onCenterChanged", new Point(0, 0));
}).then(function () { }).then(function () {
assert.equal(1, logger.getWarnings().length); assert.equal(2, logger.getWarnings().length);
}); });
}); });
}); });
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment