We're using raven-sentry in our application and I would like to have a default 'catch all' set of extra options applied to all errors.
class StandardError
def raven_context
extra = {}
#add conditional key/values to the hash if they exist
extra[:account_id] = @account.id if @account
extra.empty? ? {} : { extra: extra }
end
end
Because the exception is raising from an instantiated class in either a model or controller, I thought I'd be able to access those variables. If accounts#show raised an exception, I'd want to be able to access @account. If Account.create() raised an exception, I'd like to be able to get some information about that account, like errors.
Is this possible? and if so, how?