Actions
Bug #18682
closeddoc: raise also accepts instances
Bug #18682: doc: raise also accepts instances
Description
https://ruby-doc.org/core-3.1.1/Kernel.html#method-i-raise says
Otherwise, the first parameter should be an Exception class (or another object that returns an Exception object when sent an exception message). Well, it can also be an instance of Exception, not just a class.
PS/ I've had to create a new account to create this issue, because I could not find how to get the 2FA code I needed to use my older account. I can recreate a new password (which I did not need), but I cannot get back the 2FA configuration.
Updated by mame (Yusuke Endoh) over 3 years ago
- Status changed from Open to Closed
I think it is the case of "another object that returns an Exception object hen sent an exception message".
In other words, raise RuntimeError.new("foo") raises RuntimeError.new("foo").exception, which is #<RuntimeError: foo>.
RuntimeError.new("foo").exception #=> #<RuntimeError: foo> I have no idea why and how this spec is designed :-)
I close this ticket, but a suggestion for English improvement is welcome.
Actions