Created
May 18, 2017 05:48
-
-
Save marshall-lee/65f604bcf4a519dea0385e1063982d4f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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