Created
February 11, 2019 23:01
-
-
Save sahglie/5d83430db5f3f25ec74337524afa4bbf to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require_relative "../config/environment" | |
require 'airbrake/logger' | |
Rails.logger = Airbrake::AirbrakeLogger.new(Rails.logger) | |
class One | |
Error = Class.new(StandardError) | |
def self.run | |
raise Error.new("raise one error") | |
end | |
end | |
class Two | |
Error = Class.new(StandardError) | |
def self.run | |
One.run | |
rescue One::Error => e | |
raise Error.new("re-raise and wrap one error") | |
end | |
end | |
begin | |
Two.run | |
rescue Two::Error => e | |
Rails.logger.error(e) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment