yukatan / commangular

Command framework for AngularJS
MIT License
83 stars 8 forks source link

CommAngular swalows the errors throwed by services called from commands #9

Closed tstankevicius closed 9 years ago

tstankevicius commented 9 years ago

Hello,

whenever error occurs on the service code called by command, the error is caught in commangular and simple message gets printed in console without providing stackstrace of where the error actually occurred.

Could you please fix it?

Thank you in advance.

yukatan commented 9 years ago

I have been thinking about add a debug mode to print this type of errors during development or maybe delegate errors to angular $exceptionHandler.

Could you print here the content of the error object managed by commangular?? commangular manage error as promises do, maybe if no handlers are found in commangular to manage an error commangular should launch an exception.

tstankevicius commented 9 years ago

Hi,

e.g.: the Javascript console prints only the following message:

"Cannot read property 'subscribe' of undefined commangular.js:490"

and the requested error object which actually contains stack is as below. Maybe you could expose stack to the console as well?

Thank you.

error: TypeError message: "Cannot read property 'subscribe' of undefined" stack: "TypeError: Cannot read property 'subscribe' of undefined↵ at Object.execute (https://localhost:9000/resources/cdn/webcomponents/glp/scripts/common/command/saveEntityToProxyCommand.js:16:22)↵ at Object.e as invoke↵ at CommandContext.invoke (https://localhost:9000/resources/cdn/libs/bower_components/commangular/dist/commangular.js:370:21)↵ at https://localhost:9000/resources/cdn/libs/bower_components/commangular/dist/commangular.js:252:22↵ at https://localhost:9000/resources/cdn/libs/bower_components/angular/angular.min.js:112:276↵ at l.$get.l.$eval (https://localhost:9000/resources/cdn/libs/bower_components/angular/angular.min.js:126:84)↵ at l.$get.l.$digest (https://localhost:9000/resources/cdn/libs/bower_components/angular/angular.min.js:123:195)↵ at l.$get.l.$apply (https://localhost:9000/resources/cdn/libs/bower_components/angular/angular.min.js:126:362)↵ at l (https://localhost:9000/resources/cdn/libs/bower_components/angular/angular.min.js:81:422)↵ at O (https://localhost:9000/resources/cdn/libs/bower_components/angular/angular.min.js:86:51)" get stack: function () { [native code] } set stack: function () { [native code] } proto: Error Call Stack Scope Variables Local def: undefined error: TypeError this: undefined Closure Closure Closure Window Global Breakpoints commangular.js:490 console.log(error && error.message); orderAwardDirective.js:41 scope.selectBillingAccount = function(selectedBillingAccount, index) { DOM Breakpoints XHR Breakpoints Event Listener Breakpoints Workers ConsoleSearchEmulationRendering

yukatan commented 9 years ago

Ok, to move the responsability for printing the error to the $exceptionHandler should be enough. I will add it as soon as I can