Currenlty i'm developing app using angular js but still figuring out how to send user's data to airbrake. I'm using ng-token-auth to handle the authorization (ng-token-auth)
This is my factory
'use strict';
app.factory('$exceptionHandler', ['$injector', function ($injector) {
function log(exception, cause) {
if (currentEnv === 'dev') {
Airbrake.push({
error : {
message : exception.toString(),
stack : exception.stack
},
params : {
user : how_to_add_user_here
}
});
}
}
return(log);
}]
);
How I can inject the user to the factory?
Really appreciate your help.
Thanks
'use strict';
app.factory('$exceptionHandler', ['$injector', 'user', function ($injector, user) {
function log(exception, cause) {
if (currentEnv === 'dev') {
Airbrake.push({
error : {
message : exception.toString(),
stack : exception.stack
},
params : {
user : user.name // for example
}
});
}
}
return(log);
}]
);