TypeError not logged
claudia
Posted on
Nov 26 2015
Hi,
We had several occurrences of a TypeError happening in our production app, and realised Raygun has not logged them. So we simulated a couple of similar errors locally, only to find out they were not logged in the interface either.
This was the one we couldn't see in Raygun's interface:
TypeError: Cannot read property 'map' of undefined
We have also thrown a custom error, which was not logged either.
We did manage to log a different error, related to Angular not being able to inject a module.
Any reason why this could be happening?
Thank you
Daniel
Posted on
Nov 27 2015
Hey Claudia,
Just wondering how Raygun and Angular are setup on your end? Are you including both the standard Javascript handler and the Angular handler? If there's one missing it will skip reporting certain errors as they bounce through different places.
I have an Angular application running in the wild that is setup roughly like this - hopefully it help :)
At the bottom of my main template file, I set up Raygun itself (The snippet is at the top of my file)
<script type="text/javascript">
rg4js('apiKey', '{{config.Raygun.JSKey}}');
rg4js('attach', true);
rg4js('enablePulse', true);
rg4js('setUser', {
identifier: '{{user.email}}',
isAnonymous: false,
email: '{{user.email}}',
fullName: '{{user.name}}'
});
</script>
And in my main app.js Angular file in the main setup function, I have
$provide.decorator("$exceptionHandler", ['$delegate', function ($delegate) {
return function (exception, cause) {
Raygun.send(exception);
$delegate(exception, cause);
};
}]);
Which sends Angular specific errors through to Raygun.
Let me know how you get on - more than happy to answer any other questions!
Daniel
claudia
Posted on
Nov 28 2015
That did the trick, thank you, Daniel!