1602 / compound

MVC framework. Built on Node.JS. Works on server and browser.
http://compoundjs.com
1.6k stars 182 forks source link

Cannot read property 'skipLogging' of undefined #641

Closed sachinik19 closed 10 years ago

sachinik19 commented 10 years ago

When updated compund to ver. 1.1.14.

Extract from StackTrace :

Safely killing child process on Error: TypeError: Cannot read property 'skipLogging' of undefined at ControllerBridge.getInstance (/home/suchit/dev/website/node_modules/compound/lib/controller-bridge.js:231:26) at ControllerBridge.loadController (/home/suchit/dev/website/node_modules/compound/lib/controller-bridge.js:193:21)

Possible Fix : In /lib/controller-bridge.js line 223

var Controller, buildFromEval;
if (name in controllers && !name.match(/_controller$/)) {
    Controller = compound.controller.constructClass(name, controllers[name]);
    Controller.skipLogging = controllers[name].skipLogging;
} else {
    Controller = compound.controller.constructClass(name);
    buildFromEval = controllers[name + '_controller'];
    Controller.skipLogging = controllers[name+ '_controller'].skipLogging;
}
asergiychuk commented 10 years ago

same here. How can it fixed?

    var Controller, buildFromEval;
    if (name in controllers && !name.match(/_controller$/)) {
        Controller = compound.controller.constructClass(name, controllers[name]);
    } else {
        Controller = compound.controller.constructClass(name);
        buildFromEval = controllers[name + '_controller'];
    }
    if (controllers[name].skipLogging) {
        Controller.skipLogging = controllers[name].skipLogging;
    }

line 231 if (controllers[name].skipLogging) {

name = 'index' but object controllers does not contain this properties

1602 commented 10 years ago

Thanks guys, fixed, released.