Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
0266d7cc
Commit
0266d7cc
authored
Mar 15, 2018
by
Piotr Gawron
Browse files
error handling in plugin loa improved (when plugins crash)
parent
5555075b
Pipeline
#4098
passed with stage
in 1 minute and 10 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend-js/src/main/js/plugin/Plugin.js
View file @
0266d7cc
...
...
@@ -135,10 +135,16 @@ Plugin.prototype.unload = function () {
};
Plugin
.
prototype
.
getName
=
function
()
{
if
(
this
.
getLoadedPluginData
()
===
undefined
)
{
return
""
;
}
return
this
.
getLoadedPluginData
().
getName
();
};
Plugin
.
prototype
.
getVersion
=
function
()
{
if
(
this
.
getLoadedPluginData
()
===
undefined
)
{
return
""
;
}
return
this
.
getLoadedPluginData
().
getVersion
();
};
...
...
frontend-js/src/test/js/plugin/Plugin-test.js
View file @
0266d7cc
...
...
@@ -62,7 +62,7 @@ describe('Plugin', function () {
return
plugin
.
load
().
then
(
function
()
{
assert
.
notOk
(
"
expected 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 () {
return
plugin
.
load
().
then
(
function
()
{
assert
.
false
(
"
expected 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
()
{
...
...
@@ -86,8 +86,8 @@ describe('Plugin', function () {
});
return
plugin
.
load
().
then
(
function
()
{
assert
.
false
(
"
expected error
"
);
}
,
function
(
error
)
{
assert
.
ok
(
error
.
message
.
indexOf
(
"
Let's reject
"
)
>=
0
);
}
).
catch
(
function
(
error
)
{
assert
.
ok
(
error
.
message
.
indexOf
(
"
Let's reject
"
)
>=
0
,
"
Wrong message:
"
+
error
.
message
);
});
});
});
...
...
frontend-js/testFiles/apiCalls/plugins/POST_hash=273dffdc94ef22531b90fb4489ba00c3&name=plugin%20with%20promise&url=.%2FtestFiles%2Fplugin-invalid%2Fresult-promise-crash.js&version=0.0.1&token=MOCK_TOKEN_ID&
0 → 100644
View file @
0266d7cc
{
"hash": "273dffdc94ef22531b90fb4489ba00c3",
"name": "plugin with promise",
"urls": [
"./testFiles/plugin-invalid/result-promise-crash.js"
],
"version": "0.0.1"
}
\ No newline at end of file
frontend-js/testFiles/apiCalls/plugins/POST_hash=c36d817fb1e6c3a7b569ee9ba55baa76&url=.%2FtestFiles%2Fplugin-invalid%2Finvalid_javascript.js&token=MOCK_TOKEN_ID&
0 → 100644
View file @
0266d7cc
{
"hash": "c36d817fb1e6c3a7b569ee9ba55baa76",
"name": "",
"urls": [
"./testFiles/plugin-invalid/invalid_javascript.js"
],
"version": ""
}
\ No newline at end of file
frontend-js/testFiles/apiCalls/plugins/POST_hash=d5d652ac0e0f6467d4cb6a742f99d3f7&name=test%20plugin&url=.%2FtestFiles%2Fplugin-invalid%2Finvalid_register.js&version=0.0.1&token=MOCK_TOKEN_ID&
0 → 100644
View file @
0266d7cc
{
"hash": "d5d652ac0e0f6467d4cb6a742f99d3f7",
"name": "test plugin",
"urls": [
"./testFiles/plugin-invalid/invalid_register.js"
],
"version": "0.0.1"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment