Fix pattern to detect exceptions