Chris Nicholson-Sauls wrote:
BCS wrote:
Hello Jesse,
On Wed, 18 Nov 2009 18:27:47 -0800, Andrei Alexandrescu wrote:
Thanks! Question - is there a way to fetch the current Throwable from
within a finally clause?
Andrei
I'm pretty sure you can't since finally isn't passed an exception. I
also don't see anything in my quick search.
That stands to reason because in some cases (when things go correctly)
there isn't one.
One hopes. Just the same: (hypothetical syntax incoming)
try {
// ...
}
catch ( ExceptionA exa ) {
// ...
}
catch ( ExceptionB exb ) {
// ...
}
finally ( x ) {
// ...
if ( x ) throw new ExceptionC( x );
}
And obviously if finally has no () it doesn't bother with the feature.
-- Chris Nicholson-Sauls
I'm not that fancy. An API call getCurrentError returning an Error
object or null is all that's needed. And more general too.
Andrei