Add Toolbar factory, Use new factory entry for cancel buttons, better check of twig errors, fix fatal error page

This commit is contained in:
Eric
2021-02-09 14:16:23 +01:00
parent e11252a2d6
commit 3c60e4f765
24 changed files with 232 additions and 83 deletions

View File

@@ -10,8 +10,8 @@ use Combodo\iTop\Application\TwigBase\UI\UIBlockExtension;
use Exception;
use IssueLog;
use Twig\Environment;
use Twig\Error\Error;
use Twig_Environment;
use Twig_Error;
use Twig_Loader_Filesystem;
use utils;
use WebPage;
@@ -114,7 +114,6 @@ class TwigHelper
* @param bool $bLogMissingFile
*
* @return string
* @throws \Twig\Error\LoaderError
* @throws \Twig\Error\RuntimeError
* @throws \Twig\Error\SyntaxError
* @throws \Exception
@@ -123,13 +122,13 @@ class TwigHelper
{
try {
return $oTwig->render($sName.'.'.$sTemplateFileExtension.'.twig', $aParams);
} catch (Twig_Error $e) {
} catch (Error $e) {
$sPath = '';
if ($e->getSourceContext()) {
$sPath = utils::LocalPath($e->getSourceContext()->getPath()).' ('.$e->getLine().') - ';
}
$sMessage = $sPath.$e->getMessage();
if (!utils::StartsWith($e->getMessage(), 'Unable to find template')) {
if (strpos($e->getMessage(), 'Unable to find template') === false) {
IssueLog::Error($sMessage);
// Todo 3.0 Less violent message
throw new Exception($sMessage);