📎 Webclip
Don't rescue Exception, rescue StandardError
Ruby should almost never rescue Exception. The page contrasts Ruby with C# and Java, where catch (Exception) can be used to rescue all exception types, and says Ruby code should instead rescue StandardError.
Reading notes#
- In C# or Java,
catch (Exception)rescues all exception types. - In Ruby,
Exceptionshould almost never be rescued. - The recommended default in Ruby is to rescue
StandardError.
