Last active
February 7, 2018 17:34
-
-
Save vemarav/6eb6be68e4e9ec2f403426cb0f27d8eb to your computer and use it in GitHub Desktop.
Never rescue Exceptions in Ruby! as shown in below code.
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
begin | |
# code that raise an error | |
# or an exception | |
rescue Exception => e | |
# e is an Exception object contains | |
# information of the error | |
# e.message is the information | |
# about why error occurred and | |
# which object caused the error, | |
# where e.backtrace(Array) holds | |
# information about where and | |
# which object caused the error | |
puts e.message, e.backtrace | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment