From bb898d8f5a481628bd97be0060b4f3666b682ffc Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 9 Mar 2017 16:24:12 +0200 Subject: [PATCH] Log more PhantomJS failure details --- app/Models/Invoice.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 898e030651ea..6443dec0ad6e 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1237,18 +1237,21 @@ class Invoice extends EntityModel implements BalanceAffecting $pdfString = strip_tags($pdfString); } catch (\Exception $exception) { - Utils::logError("PhantomJS - Failed to create pdf: {$exception->getMessage()}"); - + Utils::logError("PhantomJS - Failed to load: {$exception->getMessage()}"); return false; } if (! $pdfString || strlen($pdfString) < 200) { - Utils::logError("PhantomJS - Failed to create pdf: {$pdfString}"); - + Utils::logError("PhantomJS - Invalid response: {$pdfString}"); return false; } - return Utils::decodePDF($pdfString); + if ($pdf = Utils::decodePDF($pdfString)) { + return $pdf; + } else { + Utils::logError("PhantomJS - Unable to decode: {$pdfString}"); + return false; + } } /**