Simplify detection of exception type