September 16, 2002 - Throwing Exceptions to the System
September 16, 2002 Throwing Exceptions to the System Tips: September 2002
Yehuda Shiran, Ph.D.
|
catch
block, the system will catch the thrown exception and will attempt to open an application of your choice for debugging the error. The following code sample includes an inner try...catch...finally
statement embedded inside the try
block of an outer try...finally
statement. Notice that the outer statement does not have a catch
block:
try {
print("In outer try block...");
try {
print("In inner try block...");
throw "Error 325 from inner try block";
}
catch(e) {
print("Inner catch block caught " + e);
throw e + " re-thrown from inner catch block";
}
finally {
print("In inner finally block...");
}
}
finally {
print("In outer finally block...");
}
Here is the window you would get:To avoid such windows, always catch exceptions yourself.
To learn more about exception handling, go to Column 118, JScript .NET, Part XII: Exception Handling.