From 526e8f62d32c7c2e1daaea8976f695cd79303ca3 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 16 Jun 2014 15:21:40 +0200 Subject: [PATCH] Added error if upgrades are missing. --- js/h5p-content-upgrade.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/h5p-content-upgrade.js b/js/h5p-content-upgrade.js index 5ed5b7c..d194cc9 100644 --- a/js/h5p-content-upgrade.js +++ b/js/h5p-content-upgrade.js @@ -335,8 +335,12 @@ */ ContentUpgrade.prototype.processParams = function (library, oldVersion, newVersion, params, next) { if (H5PUpgrades[library.name] === undefined) { - // TODO: Add error if we have loaded a script but cannot find the function? Will avoid some errors in the upgrades.js - // No upgrade hooks to run. Move on. + if (library.upgradesScript) { + // Upgrades script should be loaded so the upgrades should be here. + return next(info.errorScript.replace('%lib', library.name + ' ' + newVersion)); + } + + // No upgrades script. Move on return next(null, params); }