What's the reason for nesting the catch block inside the try block? Afaics that only opens up for odd issues like: What happens if there's other code before the catch block? What happens if there are several catch blocks? What is the visibility of the exception variable?
The idea that only explicit break statements would avoid rethrowing is neat, though I think "continue" is more apt. That idea can be used in switch-like blocks too, of course.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-01 20:51: Subject: Re: throw or return
How about:
try(Exception e) { catch { format(); }
if(e->foobar) { write_error_message(); break; } if(e->gazonk) { fatal_error(); } }
The point of this syntax would be that the exception is automatically re-thrown at the end of the try statement, unless a break is encountered, only then is the error discarded.
/ Fredrik (Naranek) Hubinette (Real Build Master)