Q:

Class CustomExceptionController does not exist Symfony4

For a application, I would like to create a custom error 404 page in symfony 4.
But Symfony after have follow the documentation, he out in all the page :
Invalid service "App\Controller\CustomExceptionController": class "App\Controller\CustomExceptionController" does not exist.

I don't know why he can't find this class while I have all the plugins necessary for create a custom error page.
error404.html.twig
{% extends 'base.html.twig' %}

{% block main %}
    <h1>Page not found</h1>

    <p>
        The requested page couldn't be located. Checkout for any URL
        misspelling or <a href="{{ path('home') }}">return to the homepage</a>.
    </p>
{% endblock %}

services.yaml
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: 'fr'

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/*'
        exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'

    # controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
        resource: '../src/Controller'
        tags: ['controller.service_arguments']

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones

    App\Controller\CustomExceptionController:
        public: true
        arguments:
            $debug: '%kernel.debug%'

twig.yaml
twig:
    default_path: '%kernel.project_dir%/templates'
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    exception_controller: App\Controller\ExceptionController::showException

the error page

A:

If you just want to modify the template for the 404 error page, then you don't have to create a new exception controller, just override the error template error404.html.twig as described here. This is the easiest way to adjust any error page. 
However if you want your custom logic to generate error pages, then you have to write your own exception controller, i.e. you have to actually implement the class App\Controller\CustomExceptionController, not only point to it in your yaml configs. The easiest way is to extend the default ExceptionController and override the showAction() and/or findTemplate() methods. Then point to your controller in the twig configuration:
# twig.yaml
twig:
    [...] 
    exception_controller: App\Controller\CustomExceptionController::showAction

