Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Printing error if specs is missing a mojit type, or if the mojit does…
Browse files Browse the repository at this point in the history
… not exist.
  • Loading branch information
aljimenez committed Jun 13, 2014
1 parent 33cb425 commit 20950b2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/app/autoload/store.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
spec.config = {};
}

if (!spec.type) {
return cb(new Error('Instance is missing a mojit type.'));
}

// type details
try {
typeDetails = this.getMojitTypeDetails(env, ctx, spec.type);
Expand Down Expand Up @@ -658,7 +662,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {

// if lazyLangs is on then determine the closetLang for this mojit and add the corresponding lang resources
// if they havent been added already.
if (this.lazyLangs) {
if (this._unloadedLangs[mojitType]) {
closestLang = Y.mojito.util.findClosestLang(ctx.lang, this._unloadedLangs[mojitType]);
newModules = this._loadMojitLangs(mojitType, closestLang) || newModules;
}
Expand Down Expand Up @@ -1532,7 +1536,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
* You most often don't want to call this directly, but instead to hook
* into it using the AOP mechanism of `Y.Plugin.Base`:
*
* this.beforeHostMethod('parseResourceVersion', this._myParseResource, this);
* this.beforeHostMethod('addResourceVersion', this._myAddResourceVersion, this);
*
* @method addResourceVersion
* @param {object} res the resource version
Expand Down Expand Up @@ -1648,6 +1652,10 @@ YUI.add('mojito-resource-store', function(Y, NAME) {

ress = this._mojitRVs[type];

if (!ress) {
throw new Error('Cannot find the "' + type + '" mojit. Make sure "' + type + '" exists in the application."');
}

this._mojitDetails[type] = {};

for (r = 0; r < ress.length; r++) {
Expand Down

0 comments on commit 20950b2

Please sign in to comment.