catch errors

This commit is contained in:
Denis Duliçi
2020-07-10 13:37:48 +03:00
parent a2bd4758ad
commit 0c061a01ea
3 changed files with 23 additions and 5 deletions

View File

@ -78,7 +78,13 @@ class InvoiceReminder extends Command
$invoices = Invoice::with('contact')->accrued()->notPaid()->due($date)->cursor();
foreach ($invoices as $invoice) {
event(new InvoiceReminded($invoice));
try {
event(new InvoiceReminded($invoice));
} catch (\Exception | \Throwable | \Swift_RfcComplianceException | \Illuminate\Database\QueryException $e) {
$this->error($e->getMessage());
logger('Invoice reminder:: ' . $e->getMessage());
}
}
}
}