Fixed error handling.

semantics-font
Frode Petterson 2015-03-04 11:30:20 +01:00
parent c91391e0bc
commit 6d4caf855d
2 changed files with 8 additions and 4 deletions

View File

@ -23,7 +23,7 @@ var messageHandlers = {
postMessage({
action: 'error',
id: job.id,
err: err
err: err.message ? err.message : err
});
return;

View File

@ -381,6 +381,8 @@
* @param {Function} next
*/
ContentUpgrade.prototype.loadScript = function (url, next) {
var self = this;
if (scriptsCache[url] !== undefined) {
next();
return;
@ -406,14 +408,16 @@
*
*/
ContentUpgrade.prototype.printError = function (error) {
var self = this;
if (error.type === 'errorParamsBroken') {
error = info.errorContent.replace('%id', error.id) + ' ' + info.errorParamsBroken; // TODO: Translate!
error = info.errorContent.replace('%id', error.id) + ' ' + info.errorParamsBroken;
}
else if (error.type === 'scriptMissing') {
error.err = info.errorScript.replace('%lib', error.library);
error = info.errorScript.replace('%lib', error.library);
}
self.setStatus('<p>' + info.error + '<br/>' + error.err + '</p>');
self.setStatus('<p>' + info.error + '<br/>' + error + '</p>');
};
})(H5P.jQuery, H5P.Version);