From f98a4deeffc1746c1790dd3c1842a780c1fc6402 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 8 Apr 2018 10:43:35 +0300 Subject: [PATCH] Handle UBL errors --- app/Jobs/ConvertInvoiceToUbl.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Jobs/ConvertInvoiceToUbl.php b/app/Jobs/ConvertInvoiceToUbl.php index f50b534069ec..323e0401bf0f 100644 --- a/app/Jobs/ConvertInvoiceToUbl.php +++ b/app/Jobs/ConvertInvoiceToUbl.php @@ -2,6 +2,8 @@ namespace App\Jobs; +use Utils; +use Exception; use App\Jobs\Job; use CleverIt\UBL\Invoice\Generator; use CleverIt\UBL\Invoice\Invoice; @@ -73,7 +75,13 @@ class ConvertInvoiceToUbl extends Job ->setTaxExclusiveAmount($taxable) ->setPayableAmount($invoice->balance)); - return Generator::invoice($ublInvoice, $invoice->client->getCurrencyCode()); + try { + return Generator::invoice($ublInvoice, $invoice->client->getCurrencyCode()); + } catch (Exception $exception) { + Utils::logError($exception); + + return false; + } } private function createParty($company, $user)