Log more PhantomJS failure details

This commit is contained in:
Hillel Coren 2017-03-09 16:24:12 +02:00
parent 5f8d8517af
commit bb898d8f5a

View File

@ -1237,18 +1237,21 @@ class Invoice extends EntityModel implements BalanceAffecting
$pdfString = strip_tags($pdfString); $pdfString = strip_tags($pdfString);
} catch (\Exception $exception) { } catch (\Exception $exception) {
Utils::logError("PhantomJS - Failed to create pdf: {$exception->getMessage()}"); Utils::logError("PhantomJS - Failed to load: {$exception->getMessage()}");
return false; return false;
} }
if (! $pdfString || strlen($pdfString) < 200) { if (! $pdfString || strlen($pdfString) < 200) {
Utils::logError("PhantomJS - Failed to create pdf: {$pdfString}"); Utils::logError("PhantomJS - Invalid response: {$pdfString}");
return false; return false;
} }
return Utils::decodePDF($pdfString); if ($pdf = Utils::decodePDF($pdfString)) {
return $pdf;
} else {
Utils::logError("PhantomJS - Unable to decode: {$pdfString}");
return false;
}
} }
/** /**