1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Catch/log recurring invoice errors

This commit is contained in:
Hillel Coren 2017-07-12 12:37:19 +03:00
parent 19f9030200
commit a85343c8e8

View File

@ -13,6 +13,8 @@ use DateTime;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Auth;
use Exception;
use Utils;
/**
* Class SendRecurringInvoices.
@ -110,12 +112,18 @@ class SendRecurringInvoices extends Command
$account = $recurInvoice->account;
$account->loadLocalizationSettings($recurInvoice->client);
Auth::loginUsingId($recurInvoice->user_id);
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
if ($invoice && ! $invoice->isPaid()) {
$this->info('Sending Invoice');
$this->mailer->sendInvoice($invoice);
try {
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
if ($invoice && ! $invoice->isPaid()) {
$this->info('Sending Invoice');
$this->mailer->sendInvoice($invoice);
}
} catch (Exception $exception) {
$this->info('Error: ' . $exception->getMessage());
Utils::logError($exception);
}
Auth::logout();
}
}