We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 998651d + a3ffa4b commit da05823Copy full SHA for da05823
1 file changed
lib/type_toolkit/ext/nil_assertions.rb
@@ -27,7 +27,9 @@ module TypeToolkit
27
#
28
# `UnexpectedNilError` should never occur in well-formed code, so it should never be rescued.
29
# This is why it inherits from `Exception` instead of `StandardError`,
30
- # so that bare rescues clauses (like `rescue => e`) don't rescue it.
+ # so that bare rescue clauses (like `rescue => e`) don't accidentally swallow it.
31
+ #
32
+ # Note: `rescue Exception` can still catch it, but that's intentionally harder to write accidentally.
33
class UnexpectedNilError < Exception # rubocop:disable Lint/InheritException
34
def initialize(message = "Called `not_nil!` on nil.")
35
super
0 commit comments