mojito
mojito copied to clipboard
Better reporting of errors in config files
This is a possible improvement: If I start up a Mojito server, but added 1 comment to the file mojits/hello/defaults.json
:
"someName" : "someValue" // TODO: correct this value later
which is illegal in a .json
file but is an easy mistake to make.
and then did something else, such as update my package dependencies, and some code changes, and so forth, and I restart the server, then when loading the mojit, it will fail with:
error: (mojito-composite-addon): Error executing child mojit at 'child': error: (mojito-composite-addon): Cannot expand instance [@hello], or instance.controller is undefined error: (mojito-composite-addon): Error: Cannot expand instance [@hello], or instance.controller is undefined at YUI.add.Y.namespace.Dispatcher.dispatch (/mnt/some.host.com/vol/home1/mike/dev/cocktails/myapp/app/node_modules/mojito/lib/app/autoload/dispatch.server.js:142:39)
Can the error show a message about mojits/hello/defaults.json
having an issue? Otherwise, it might need to be hunted down and we will need to be looking at other code changes, or even look at the package dependencies and see if it might be the cause, and a lot of time could be wasted. (since it has an error but won't tell you where it is). If it can report mojits/hello/defaults.json
is causing it, the time can be just 1 minute.
We can definitely improve error messages when it comes to invalid files and syntax errors.
In the case of the comments, you can get use to use .yaml files instead of .json to be able to add comments (supported in 0.5.x). You don't need to rework the content, u just need to rename and add your yaml comments.
@kinlum Agreed! Thanks for reporting this.