finally 句内から、例外がスローされていることを検出する方法はありますか?
以下の例を参照してください。
try {
// code that may or may not throw an exception
} finally {
SomeCleanupFunctionThatThrows();
// if currently executing an exception, exit the program,
// otherwise just let the exception thrown by the function
// above propagate
}
または、例外の 1 つを無視することしかできませんか?
C++ では、例外の 1 つを無視することさえできず、terminate() を呼び出すだけです。他のほとんどの言語は、Java と同じ規則を使用します。