Commit fcb3b6ea authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '803-when-plugin-crash-put-on-the-console-stacktrace' into 'master'

Resolve "when plugin crash put on the console stacktrace"

Closes #803

See merge request !758
parents 025c546f 6d379f36
Pipeline #10011 failed with stage
in 15 minutes and 47 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