Created
February 17, 2017 11:45
-
-
Save alekseyl/cb7af091d4dfc137dd1dc1c13549767c to your computer and use it in GitHub Desktop.
run_async_with_rescue example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_async_with_rescue( airbrake_params = {} ) | |
backtrace = Kernel.caller | |
Thread.new do | |
begin | |
yield | |
rescue => e | |
e.set_backtrace( backtrace ) | |
notice = Airbrake.build_notice(e, airbrake_params) | |
Airbrake.notify(notice) if notice | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment