title: symfony 4 - Custom error page & custom error message
body: <p>I want to create my custom error page (404, 403, etc.) in Symfony 4 so I have exception, e.g.  </p>
  
  <pre><code>if (!$thisVarIsNull) {
      throw $this-&gt;createNotFoundException(
          'This is my custom message'
      );
  }
  </code></pre>
  
  <p>and I have created basic template in location <code>templates/bundles/TwigBundle/Exception/error.html.twig</code>:  </p>
  
  <pre><code>{% extends "base.html.twig" %}
  {% block title %}
      We got a problem
  {% endblock %}
  {% block body %}
      &lt;div&gt;
          &lt;p&gt;
              {{ status_code }} :: {{ exception.message }}
          &lt;/p&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>but the <code>exception.message</code> does not return anything. Where is the problem?</p>