I ned to check mail subject if it contains invoices then need to proceed further if any mail does not contain invoice in its subject I need to throw an error problem is I need to throw error after iterating through every email

@Akanksha11 If you want to throw a exception after compilation of every Iteration, so please put bool variable in else and assign false and use that variable where you want to place throw