Check for the correct exception type