Why are Exceptions said to be so bad for Input Validation?

Reading these answers, I find it very unhelpful to say, “Exceptions should only be used for exceptional conditions”. This begs the whole question of what is an “exceptional condition”. This is a subjective term, the best definition of which is “any condition that your normal logic flow doesn’t deal with”. In other words, an exceptional … Read more

What is causing my OLEDbException, IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

I apparently was mistaken when I said the query did not contain any reserved words. The query I was using was selecting from another query in the Access Database. That other query had a reserved keyword that was causing the problem. BTW: The Access database engine runs in different modes, depending on whether it is … Read more

How do I not log a particular type of Exception in Logback?

You can do it with a simple EvaluatorFilter: <filter class=”ch.qos.logback.core.filter.EvaluatorFilter”> <evaluator> <expression>java.lang.RuntimeException.class.isInstance(throwable)</expression> </evaluator> <onMatch>DENY</onMatch> </filter> Please note that you need the following dependency in your pom.xml as well: <dependency> <groupId>org.codehaus.janino</groupId> <artifactId>janino</artifactId> <version>3.1.9</version> </dependency> Another possible solution is a custom Filter implementation: import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.ThrowableProxy; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; public class SampleFilter extends … Read more

How do exceptions in Haskell work?

The answer is that this is the (somewhat surprising) semantics of imprecise exceptions When pure code can be shown to evaluate to a set of exceptional values (i.e. the value of error or undefined, and explicitly not the kind of exceptions generated in IO), then the language permits any value of that set to be … Read more

Why not catch general Exceptions

Swallowing exceptions is a dangerous practice because: It can cause the user to think something succeeded when it actually failed. It can put your application into states that you didn’t plan for. It complicates debugging, since it’s much harder to find out where the failure happened when you’re dealing with bizarre/broken behavior instead of a … Read more