diff --git a/src/Exceptions/TwigModeException.php b/src/Exceptions/TwigModeException.php index b76d14d3..ea84667a 100644 --- a/src/Exceptions/TwigModeException.php +++ b/src/Exceptions/TwigModeException.php @@ -42,15 +42,14 @@ declare(strict_types=1); namespace App\Exceptions; use RuntimeException; -use Twig\Error\Error; class TwigModeException extends RuntimeException { private const PROJECT_PATH = __DIR__ . '/../../'; - public function __construct(?Error $previous = null) + public function __construct(?\Throwable $previous = null) { - parent::__construct($previous->getMessage(), 0, $previous); + parent::__construct($previous?->getMessage() ?? "Unknown message", 0, $previous); } /** diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php index 8a5201ff..31093953 100644 --- a/src/Services/LabelSystem/LabelHTMLGenerator.php +++ b/src/Services/LabelSystem/LabelHTMLGenerator.php @@ -95,7 +95,7 @@ final class LabelHTMLGenerator 'paper_height' => $options->getHeight(), ] ); - } catch (Error $exception) { + } catch (\Throwable $exception) { throw new TwigModeException($exception); } } else {