Created
January 20, 2021 05:13
-
-
Save mitsuhirookuno/01e6c46287cb10d6fa908b158bd304ab to your computer and use it in GitHub Desktop.
Mysql2の例外のみ補足したい
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
def main(raise_class) | |
raise raise_class, 'try rescue!' | |
rescue Mysql2::Error | |
puts "catch #{$!}" | |
rescue | |
puts "Through #{$!}" | |
end | |
main(Mysql2::Error) | |
main(Mysql2::Error::TimeoutError) | |
main(Mysql2::Error::ConnectionError) | |
main(StandardError) | |
main(ArgumentError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment