Created
October 20, 2014 23:20
-
-
Save jbodah/2af052ca9604924016da to your computer and use it in GitHub Desktop.
Ruby exception wrapping
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
# A generic error that implementations can use to wrap their exceptions with | |
class BaseWrapperException < StandardError | |
def initialize(e = nil) | |
super e | |
return self unless e.present? && e.is_a?(Exception) | |
# Preserve the original exception's data | |
set_backtrace e.backtrace | |
message.prepend "#{e.class}: " | |
end | |
end |
Author
jbodah
commented
Oct 20, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment