Skip to content

Instantly share code, notes, and snippets.

@sahglie
Created February 11, 2019 23:01
Show Gist options
  • Save sahglie/5d83430db5f3f25ec74337524afa4bbf to your computer and use it in GitHub Desktop.
Save sahglie/5d83430db5f3f25ec74337524afa4bbf to your computer and use it in GitHub Desktop.
#!/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