Skip to content

Commit

Permalink
Catch error when plugin not registered against correct node and for c…
Browse files Browse the repository at this point in the history
…orrect type
  • Loading branch information
xeolabs committed May 27, 2013
1 parent b242217 commit 4895846
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ SceneJS.Plugins = new (function () {
if (!pluginPath) {
throw "no pluginPath config"; // Build script error - should create this config
}
loadScript(pluginPath + "/" + nodeType + "/" + pluginType + ".js",
var pluginFilePath = pluginPath + "/" + nodeType + "/" + pluginType + ".js";
loadScript(pluginFilePath,
function () {
var plugin = self._nodePlugins[nodeType][pluginType];
if (!plugin) {
// Plugin was not registered correctly
throw "Problem in plugin file '" + pluginFilePath + "': call to addPlugin(nodeType, pluginType, ..) : either or both args have incorrect value";
}
ok(self._nodePlugins[nodeType][pluginType]);
});
};
Expand Down

0 comments on commit 4895846

Please sign in to comment.