YahooArchive / mojito

[archiving soon] Yahoo! Mojito Framework
BSD 3-Clause "New" or "Revised" License
1.57k stars 214 forks source link

Info-level Console Log Needed to Note that Mojits that are 'appLevel' Are Being Skipped #824

Open nottoseethesun opened 11 years ago

nottoseethesun commented 11 years ago

What Happens:

  1. Mojito is started with a mojit that has ''appLevel':true' in its 'definition.json'.
  2. The user successfully visits a mojit on that app.
  3. The user attempts to visit the mojit with the ''appLevel: true' in it, but fails due to the fact that the mojit was skipped (apparently) by the resource store.
  4. There is no log to that effect, at least on the console, as shown below (after the "Why It Should Happen" section).
  5. There is a hard JavaScript error, "TypeError: Cannot read property 'name' of undefined", thrown.
  6. Often, the user has no clue why and/or no clue about what might have happened.

What Should Happen:

The log should offer an info-level log noting that a mojit has been skipped because it is marked as 'appLevel'.

Why It Should Happen:

If a mojit or parts thereof is copied from another mojit (perhaps as part of a refactoring), it's easy for the configuration property 'appLevel' to become transferred in the process. If the user described in the "What Happens" section (above) were to check the log, and find an info-level log noting that the mojit that they fail to reach has been skipped due to an 'appLevel' setting of 'true', then they can fix it pretty quickly.

Console Log (referenced above):

quux-lm:app cbalz$ pwd /Users/cbalz/projects/y_foobar/bat/foobar-bat/app quux-lm:app cbalz$ node_modules/mojito-shaker/bin/mojito-shake --context "environment:dev" --run; [SHAKER] - Initializing ShakerCore info: (shaker): Metadata loaded correctly. info: (mojito-store): Preloading store [SHAKER] - Store preloaded correctly ✔ [SHAKER] - Analyzing Mojito App... [SHAKER] - Processing Metadata... [SHAKER] - Writting metadata... [SHAKER] - Metadata written in /Users/cbalz/projects/y_foobar/bat/foobar-bat/app/shaker-meta.json. ✔ [SHAKER] - Runtime ready. Returning control to mojito ✔ info: (shaker): Metadata loaded correctly. info: (mojito-store): Preloading store

✔ Mojito started 'foobar_bat' on http://127.0.0.1:8666/

TypeError: Cannot read property 'name' of undefined at RSAddonYUI.YUI.add.Y.extend.getResourceContent (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/lib/app/addons/rs/yui.js:573:31) at ResourceStore.YUI.add.e.rbind (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/yui/oop/oop-min.js:7:2149) at YUI.add.i.Method.exec (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/yui/event-custom-base/event-custom-base-min.js:7:1090) at ResourceStore.YUI.add.i._inject.o.(anonymous function).r.(anonymous function) as getResourceContent at Object.handle (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/lib/app/middleware/mojito-handler-static.js:379:27) at next (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/node_modules/connect/lib/http.js:204:15) at Object.module.exports as handle at next (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/node_modules/connect/lib/http.js:204:15) at Object.handle (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/lib/http.js:83:5) at next (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/node_modules/connect/lib/http.js:204:15) TypeError: Cannot read property 'name' of undefined at RSAddonYUI.YUI.add.Y.extend.getResourceContent (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/lib/app/addons/rs/yui.js:573:31) at ResourceStore.YUI.add.e.rbind (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/yui/oop/oop-min.js:7:2149) at YUI.add.i.Method.exec (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/yui/event-custom-base/event-custom-base-min.js:7:1090) at ResourceStore.YUI.add.i._inject.o.(anonymous function).r.(anonymous function) as getResourceContent at Object.handle (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/lib/app/middleware/mojito-handler-static.js:379:27) at next (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/node_modules/connect/lib/http.js:204:15) at Object.module.exports as handle at next (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/node_modules/connect/lib/http.js:204:15) at Object.handle (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/lib/http.js:83:5) at next (/Users/cbalz/projects/y_foobar/bat/foobar-bat/app/node_modules/mojito/node_modules/express/node_modules/connect/lib/http.js:204:15)

caridy commented 11 years ago

@drewfish can you check this? I'm not familiar with appLevel workflow.

drewfish commented 11 years ago

+1. Good description of problem, and good solution.

nottoseethesun commented 11 years ago

Thanks Drew!