-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
include angular-raven module for plugins #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
+1 Just about to push out the secondary package on an internal project over here. Code looks good on my end from brief skim |
The issues that I have with this are that you're trying to use some functionality which isn't exposed to the global namespace. |
I updated the PR to use angular.isFunction() and angular.isUndefined() I copied to code in order to use captureMessage that checks for the development flag. captureMessage: function captureMessage(message, data) {
if (_development) {
$log.error('Raven: Message ', message, data);
} else {
$window.Raven.captureMessage(message, data);
}
}, |
Of note, I wonder if the development flag would make sense in Raven proper? That would greatly simplify this, and maybe we could just imply development if SENTRY_DSN isnt set? |
if Raven accounted for a development mode (logging errors rather than sending them to Sentry) we can simplify it like so module.factory( 'Raven', [ '$window', function($window) {
return $window.Raven
}]);
module.factory('$exceptionHandler', ['Raven', function(Raven) {
return function(exception, cause) {
Raven.captureException(exception, cause);
};
}]); |
I can also allow the user to asynchronously load Raven.js during Angular's configuration phase if they're too lazy to include Raven before Angular. I originally removed that feature because I wanted to make sure Raven to captures all errors before Angular bootstraps including when Angular fails |
Development makes sense. Is there not a way to just conditionally load the Raven module to begin with? I can push for a development mode if it'd be worth it for 1.1.1 or something. |
I can check if Raven is in the global space then load Raven if it's not. Similar to how I handle d3 app.config(function(RavenProvider) {
var settings = {};
RavenProvider.config('DSN', settings) //etc
} Like I said the only problem is that Raven isn't loaded until angular bootstraps (after DOM is ready) I can also load raven.js it outside of Angular and check there. |
@gdi2290 How about we get a working version in, then we can iterate from there? I think for now, if we can clean up the lint warnings so Travis doesn't complain, I'll merge. Then we can add documentation. |
I updated the pull request 4 hours ago it was missing a semicolon. Travis didn't run again I'm not too sure why |
What's the status of this? I see there's an angular.js in the plugins folder, but it's not available in the CDN and it doesn't look much like the above code. |
@emosenkis I've rolled my own version, but it hasn't been tested very well, which is why it's not published to the CDN. I was planning on pushing the new ones to CDN as "experimental" status on next release to get feedback. |
Coerce error.name to string before assigning as type (fixes #155)
I created an Angular.js module for Raven.js and thought it might be great to include it as a plugin for core
Here is an example using the latest Angular