我希望在Symfony 4中创建自定义错误页面(404、403等),以便我有异常。
if (!$thisVarIsNull) {
throw $this->createNotFoundException(
'This is my custom message'
);
}
我已经在位置 templates/bundles/TwigBundle/Exception/error.html.twig
创建了一个基本模板:
{% extends "base.html.twig" %}
{% block title %}
We got a problem
{% endblock %}
{% block body %}
<div>
<p>
{{ status_code }} :: {{ exception.message }}
</p>
</div>
{% endblock %}
但是
exception.message
没有返回任何东西。问题出在哪里?