File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1968,6 +1968,31 @@ fail SomeException, 'message'
19681968raise SomeException, 'message'
19691969----
19701970
1971+ === Reraising exceptions [[reraising-exceptions]]
1972+
1973+ Call `raise` without an exception argument when reraising exceptions.
1974+
1975+ [source,ruby]
1976+ ----
1977+ # bad
1978+ begin
1979+ something_that_might_fail
1980+ rescue SomeException => e
1981+ # handle SomeException
1982+
1983+ raise e
1984+ end
1985+
1986+ # good
1987+ begin
1988+ something_that_might_fail
1989+ rescue SomeException => e
1990+ # handle SomeException
1991+
1992+ raise
1993+ end
1994+ ----
1995+
19711996=== Raising Explicit `RuntimeError` [[no-explicit-runtimeerror]]
19721997
19731998Don't specify `RuntimeError` explicitly in the two argument version of `raise`.
You can’t perform that action at this time.
0 commit comments