Created
February 7, 2018 18:23
-
-
Save vemarav/bd14d5139ac7d55f4843e5d97e46cc13 to your computer and use it in GitHub Desktop.
Rescue Type Error in case of wrong objects are passed as a parameter.
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 | |
puts "a" * 5 # => "aaaaa" | |
puts 1 + "" # => TypeError (string can't be coerced into Integer) | |
puts 5 * "a" # => Never Evaluate | |
rescue TypeError => e | |
puts e.message, e.backtrace | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment