example of using custom_data in ruby gem config
trevorjohnston
Posted on
Dec 10 2013
I'd like to include customdata for all exceptions using the ruby gem that would be specific to the request. For example, a currentuser.id. Does anyone have an example of this working?
John-Daniel Trask
Raygun
Posted on
Dec 10 2013
Hi Trevor,
You can pass a hash in as the second parameter to track_exception containing custom data:
begin
# code
rescue Exception => e
Raygun.track_exception(e, {"custom": "data"})
end
For the current user's ID, we have specialized support for affected users in the providers for other languages, but it is currently missing. We're working on adding the feature to raygun4ruby and hope to have a new version deployed within a week.
Once this is added, the count of affected users for an error will appear in the dashboard, as well as their IDs/email addresses. I'll get back to you when this feature is available for Ruby.