diff --git a/app/Console/Commands/BillReminder.php b/app/Console/Commands/BillReminder.php index 13caf2a93..69cc3075a 100644 --- a/app/Console/Commands/BillReminder.php +++ b/app/Console/Commands/BillReminder.php @@ -78,8 +78,13 @@ class BillReminder extends Command $bills = Bill::with('contact')->accrued()->notPaid()->due($date)->cursor(); foreach ($bills as $bill) { - event(new BillReminded($bill)); - + try { + event(new BillReminded($bill)); + } catch (\Exception | \Throwable | \Swift_RfcComplianceException | \Illuminate\Database\QueryException $e) { + $this->error($e->getMessage()); + + logger('Bill reminder:: ' . $e->getMessage()); + } } } } diff --git a/app/Console/Commands/InvoiceReminder.php b/app/Console/Commands/InvoiceReminder.php index 9f6d6af7e..d59aa8171 100644 --- a/app/Console/Commands/InvoiceReminder.php +++ b/app/Console/Commands/InvoiceReminder.php @@ -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()); + } } } } diff --git a/app/Console/Commands/RecurringCheck.php b/app/Console/Commands/RecurringCheck.php index cf99bd0af..e69ef3c74 100644 --- a/app/Console/Commands/RecurringCheck.php +++ b/app/Console/Commands/RecurringCheck.php @@ -145,8 +145,15 @@ class RecurringCheck extends Command $model->cloneable_relations = ['items', 'totals']; - // Create new record - $clone = $model->duplicate(); + try { + $clone = $model->duplicate(); + } catch (\Exception | \Throwable | \Swift_RfcComplianceException | \Illuminate\Database\QueryException $e) { + $this->error($e->getMessage()); + + logger('Recurring check:: ' . $e->getMessage()); + + return false; + } // Set original model id $clone->parent_id = $model->id;