1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Catch PhantomJS exceptions

This commit is contained in:
Hillel Coren 2017-01-25 14:26:37 +02:00
parent a7ffcfe7b2
commit ee0f2daa48

View File

@ -1193,7 +1193,9 @@ class Invoice extends EntityModel implements BalanceAffecting
$invitation = $this->invitations[0];
$link = $invitation->getLink('view', true);
$pdfString = false;
try {
if (env('PHANTOMJS_BIN_PATH')) {
$pdfString = CurlUtils::phantom('GET', $link . '?phantomjs=true');
} elseif ($key = env('PHANTOMJS_CLOUD_KEY')) {
@ -1205,9 +1207,13 @@ class Invoice extends EntityModel implements BalanceAffecting
}
$pdfString = strip_tags($pdfString);
} catch (Exception $exception) {
Utils::logError("PhantomJS - Failed to create pdf: {$exception->getMessage()}");
return false;
}
if ( ! $pdfString || strlen($pdfString) < 200) {
Utils::logError("PhantomJSCloud - failed to create pdf: {$pdfString}");
Utils::logError("PhantomJS - Failed to create pdf: {$pdfString}");
return false;
}