Created
October 16, 2018 23:07
-
-
Save jenikm/0f4d01ad7b88edbb8a8ef66adf555a22 to your computer and use it in GitHub Desktop.
Exposes silent errors
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
class ::Exception | |
def new_initialize(*args) | |
original_initialize(*args) | |
puts "[custom error message]: #{self.message}" | |
end | |
alias original_initialize initialize | |
alias initialize new_initialize | |
def new_set_backtrace(trace) | |
x = original_set_backtrace(trace) | |
puts "[custom Backtrace]:" | |
puts trace | |
x | |
end | |
alias original_set_backtrace set_backtrace | |
alias set_backtrace new_set_backtrace | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment