rhapsodyjs / RhapsodyJS

NodeJS HMVC framework for epic apps.
http://rhapsodyjs.github.io/
MIT License
65 stars 5 forks source link

Config loading silent failure #16

Closed riston closed 9 years ago

riston commented 9 years ago

One thing more, are you sure that while loading app configs should silently fail while having error ?

Quick fix: add logging


    configs.options = options;

    var configPaths = {
        cors: path.join(options.root, '/app/config/cors'),
        error: path.join(options.root, '/app/config/error/error'),
        httpsOptions: path.join(options.root, '/app/config/https'),
        session: path.join(options.root, '/app/config/session'),
        templateEngines: path.join(options.root, '/app/config/template-engines'),
        i18n: path.join(options.root, '/app/config/i18n')
    };

    for(var config in configPaths) {
        try {

            configs[config] = require(configPaths[config]);
        }
        catch(e) {
            // TODO: should at least console.log the error
            configs[config] = { enabled: false };
        }
    }
talyssonoc commented 9 years ago

It wasn't necessary before, but I put that try/catch there for backward compatibility, because of some new files, but I agree that it should log it, gonna fix it soon too, thanks!