Skip to content

Instantly share code, notes, and snippets.

@vemarav
Last active February 7, 2018 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vemarav/6eb6be68e4e9ec2f403426cb0f27d8eb to your computer and use it in GitHub Desktop.
Save vemarav/6eb6be68e4e9ec2f403426cb0f27d8eb to your computer and use it in GitHub Desktop.
Never rescue Exceptions in Ruby! as shown in below code.
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