diff --git a/js/h5p-content-upgrade-worker.js b/js/h5p-content-upgrade-worker.js index c201b54..4cd0047 100644 --- a/js/h5p-content-upgrade-worker.js +++ b/js/h5p-content-upgrade-worker.js @@ -23,7 +23,7 @@ var messageHandlers = { postMessage({ action: 'error', id: job.id, - err: err + err: err.message ? err.message : err }); return; diff --git a/js/h5p-content-upgrade.js b/js/h5p-content-upgrade.js index 05667d8..cd50b86 100644 --- a/js/h5p-content-upgrade.js +++ b/js/h5p-content-upgrade.js @@ -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('
' + info.error + '
' + error.err + '
' + info.error + '
' + error + '