P
Patrick Doyle
[Note: parts of this message were removed to make it a legal post.]
I have been looking at the source code for rake (as you can probably tell
from my previous questions), in an attempt to study a reasonable sized Ruby
application and see what I can learn from the exercise. I've come across
something that looks like it could be an innocuous typo in the code, or it
could be doing something that I just don't understand. Here is the code
snippet:
def standard_exception_handling
begin
yield
rescue SystemExit => ex
# Exit silently with current status
exit(ex.status)
rescue SystemExit, OptionParser::InvalidOption => ex
# Exit silently
exit(1)
end
end
I am curious as to why SystemExit shows up in 2 different rescue clauses.
Is that a typo? Or is something else going on?
--wpd
I have been looking at the source code for rake (as you can probably tell
from my previous questions), in an attempt to study a reasonable sized Ruby
application and see what I can learn from the exercise. I've come across
something that looks like it could be an innocuous typo in the code, or it
could be doing something that I just don't understand. Here is the code
snippet:
def standard_exception_handling
begin
yield
rescue SystemExit => ex
# Exit silently with current status
exit(ex.status)
rescue SystemExit, OptionParser::InvalidOption => ex
# Exit silently
exit(1)
end
end
I am curious as to why SystemExit shows up in 2 different rescue clauses.
Is that a typo? Or is something else going on?
--wpd