mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-16 14:39:37 +00:00
Catch more errors of twig labels
This commit is contained in:
parent
1c6bf3f472
commit
5e9f7a11a3
2 changed files with 3 additions and 4 deletions
|
|
@ -42,15 +42,14 @@ declare(strict_types=1);
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
use Twig\Error\Error;
|
|
||||||
|
|
||||||
class TwigModeException extends RuntimeException
|
class TwigModeException extends RuntimeException
|
||||||
{
|
{
|
||||||
private const PROJECT_PATH = __DIR__ . '/../../';
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ final class LabelHTMLGenerator
|
||||||
'paper_height' => $options->getHeight(),
|
'paper_height' => $options->getHeight(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (Error $exception) {
|
} catch (\Throwable $exception) {
|
||||||
throw new TwigModeException($exception);
|
throw new TwigModeException($exception);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue