Skip to content

Instantly share code, notes, and snippets.

@marshall-lee
Created May 18, 2017 05:48
Show Gist options
  • Select an option

  • Save marshall-lee/65f604bcf4a519dea0385e1063982d4f to your computer and use it in GitHub Desktop.

Select an option

Save marshall-lee/65f604bcf4a519dea0385e1063982d4f to your computer and use it in GitHub Desktop.
class WrappedError
def initialize(error)
@error = error
end
def exception
@error.exception
end
end
class CustomError < StandardError
end
begin
raise WrappedError.new(CustomError.new)
rescue CustomError
puts 'got custom error'
end
begin
raise WrappedError.new(CustomError.new)
rescue WrappedError
puts 'got wrapped error' # it does not happen!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment