it('should catch exceptions',
inject(function ($timeout) {
spyOn(Raven, 'captureException');
$timeout(function () {
throw new Error('My oh My');
});
$timeout.flush();
expect(Raven.captureException).toHaveBeenCalledWith('My oh My', new Error('My oh My'));
})
);
And this is the console error I get.
PhantomJS 1.9.8 (Mac OS X 0.0.0) $exceptionHandler should catch exceptions FAILED
Error: My oh My
undefined
at /Users/MyUser/App/src/app/exception.factory.spec.js:17
at invoke (/Users/MyUser/App/bower_components/angular/angular.js:4560)
at workFn (/Users/MyUser/App/bower_components/angular-mocks/angular-mocks.js:2518)
So, what am I doing wrong here? From the MDN docs I got this example:
try {
throw new Error('Whoops!');
} catch (e) {
console.log(e.name + ': ' + e.message);
}
that looks exactly what I am doing, so I don't understand how my newly defined error can be undefined...