It is a compiler warning and generally frowned upon to have unused variables in your code. Therefore the following will generate a warning because e is unused
try {
throw new InvalidOpreationException();
}
catch(Exception e) {
}
The correct way of doing this is to not give the exception a name unless you're going to make use of it:
try {
throw new InvalidOpreationException();
}
catch(Exception) {
}
But this "correct" way of doing things can be a hassle when debugging. You can set a breakpoint inside the catch but you won't have any idea why you got there unless you stop the app, name the exception, recompile and re-create the error. That's quite annoying to say the least.
The kicker is that that exception still exists, it just doesn't have an explicit name in this scope. Is there any way to access it anyway?