Optimized exception handling.