I had an exception in some code today: "A [some exception] was unhandled."
However, this code was clearly inside the "try" block of a "try/catch" structure.
What am I missing here?
Update: It's C#
Update: Oh, forget it. It turns out the specific mechanism of error is that I'm an idiot. There's no fix for this.
A throw statement can be used in a catch block to re-throw the exception that is caught by the catch statement. The following example extracts source information from an IOException exception, and then throws the exception to the parent method. You can catch one exception and throw a different exception.
One related and confusing thing to know is that in a try-[catch]-finally structure, a finally block may throw an exception and if so, any exception thrown by the try or catch block is lost.
If your application has unhandled exceptions, that may be logged in the Windows Event Viewer under the category of “Application”. This can be helpful if you can't figure out why your application suddenly crashes. Windows Event Viewer may log 2 different entries for the same exception.
An unhandled exception is an exception that does not have an associated handler. In C++ any unhandled exception terminates the program. It is unspecified whether the stack is unwound in this case, i.e. destructors of successfully constructed local variables may be executed or not depending on the compiler.
Does the catch statement specify a specific type of exception?
If it does, it will only catch that type of exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With