Skip to content
Snippets Groups Projects
Commit 0266d7cc authored by Piotr Gawron's avatar Piotr Gawron
Browse files

error handling in plugin loa improved (when plugins crash)

parent 5555075b
No related branches found
No related tags found
1 merge request!221Resolve "plugin API should allow to store user data"
Pipeline #
...@@ -135,10 +135,16 @@ Plugin.prototype.unload = function () { ...@@ -135,10 +135,16 @@ Plugin.prototype.unload = function () {
}; };
Plugin.prototype.getName = function () { Plugin.prototype.getName = function () {
if (this.getLoadedPluginData() === undefined) {
return "";
}
return this.getLoadedPluginData().getName(); return this.getLoadedPluginData().getName();
}; };
Plugin.prototype.getVersion = function () { Plugin.prototype.getVersion = function () {
if (this.getLoadedPluginData() === undefined) {
return "";
}
return this.getLoadedPluginData().getVersion(); return this.getLoadedPluginData().getVersion();
}; };
......
...@@ -62,7 +62,7 @@ describe('Plugin', function () { ...@@ -62,7 +62,7 @@ describe('Plugin', function () {
return plugin.load().then(function () { return plugin.load().then(function () {
assert.notOk("expected error"); assert.notOk("expected error");
}, function (error) { }, function (error) {
assert.ok(error.message.indexOf("Unexpected identifier") >= 0); assert.ok(error.message.indexOf("Unexpected identifier") >= 0, "Wrong message: " + error.message);
}); });
}); });
...@@ -75,7 +75,7 @@ describe('Plugin', function () { ...@@ -75,7 +75,7 @@ describe('Plugin', function () {
return plugin.load().then(function () { return plugin.load().then(function () {
assert.false("expected error"); assert.false("expected error");
}, function (error) { }, function (error) {
assert.ok(error.message.indexOf("Let's crash") >= 0); assert.ok(error.message.indexOf("Let's crash") >= 0, "Wrong message: " + error.message);
}); });
}); });
it('plugin register promise reject', function () { it('plugin register promise reject', function () {
...@@ -86,8 +86,8 @@ describe('Plugin', function () { ...@@ -86,8 +86,8 @@ describe('Plugin', function () {
}); });
return plugin.load().then(function () { return plugin.load().then(function () {
assert.false("expected error"); assert.false("expected error");
}, function (error) { }).catch( function (error) {
assert.ok(error.message.indexOf("Let's reject") >= 0); assert.ok(error.message.indexOf("Let's reject") >= 0, "Wrong message: " + error.message);
}); });
}); });
}); });
......
{
"hash": "273dffdc94ef22531b90fb4489ba00c3",
"name": "plugin with promise",
"urls": [
"./testFiles/plugin-invalid/result-promise-crash.js"
],
"version": "0.0.1"
}
\ No newline at end of file
{
"hash": "c36d817fb1e6c3a7b569ee9ba55baa76",
"name": "",
"urls": [
"./testFiles/plugin-invalid/invalid_javascript.js"
],
"version": ""
}
\ No newline at end of file
{
"hash": "d5d652ac0e0f6467d4cb6a742f99d3f7",
"name": "test plugin",
"urls": [
"./testFiles/plugin-invalid/invalid_register.js"
],
"version": "0.0.1"
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment