Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[BUG][4.1] TwigBundle : Class "twig.controller.exception" does not exist #27438

Copy link
Copy link
Closed
@macintoshplus

Description

@macintoshplus
Issue body actions

Symfony version(s) affected: 4.1.0

Description
After upgrade to Symfony 4.1.0, this error Class "twig.controller.exception" does not exist. is displayed when an exception is not catched by the user code.

How to reproduce

<?php

namespace App\Controller;

class FailController
{
    public function __invoke()
    {
        throw new \Exception("Error Processing Request", 1);
    }
}

Possible Solution

When I add this configuration, the exception handler work fine:

# config/packages/twig.yaml
twig:
    paths: ['%kernel.project_dir%/templates']
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    # I have add this line:
    exception_controller: Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction

And this service configuration

# config/services.yaml
services:

    Symfony\Bundle\TwigBundle\Controller\ExceptionController:
        alias: twig.controller.exception
        public: true

Additional context

The full error screenshot:
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.