Skip to content

Instantly share code, notes, and snippets.

@stevenjackson
Created June 21, 2019 21:20
Show Gist options
  • Save stevenjackson/c59b57c300daaf9543c4279e64649441 to your computer and use it in GitHub Desktop.
Save stevenjackson/c59b57c300daaf9543c4279e64649441 to your computer and use it in GitHub Desktop.
Alert in different envs
def record_error(error)
error.set_backtrace(Thread.current.backtrace)
if Rails.env.development?
raise error
elsif Rails.env.test?
RSpec.current_example.set_exception(error)
else
Bugsnag.notify(error) do |report|
report.severity = 'info'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment