<commit_before><?php

namespace App\EventListener;

use Symfony\Component\Console\Event\ConsoleErrorEvent;

class ConsoleExceptionLoggerEventListener extends AbstractExceptionLoggerEventListener
{
    public function onConsoleError(ConsoleErrorEvent $event)
    {
        $command = $event->getCommand();
        $input = $event->getInput();
        $error = $event->getError();

        $this->logger->error(
            $command->getName(),
            [
                'args' => $input->getArguments(),
                'options' => $input->getOptions(),
                'trace' => $error->getTrace()[0],
            ]
        );

        $event->stopPropagation();
    }
}<commit_msg>Don't catch exceptions relating to the console itself (#142)<commit_after><?php

namespace App\EventListener;

use Symfony\Component\Console\Event\ConsoleErrorEvent;

class ConsoleExceptionLoggerEventListener extends AbstractExceptionLoggerEventListener
{
    public function onConsoleError(ConsoleErrorEvent $event)
    {
        $command = $event->getCommand();
        $input = $event->getInput();
        $error = $event->getError();

        if (!substr_count(get_class($error), 'Symfony\Component\Console')) {
            $this->logger->error(
                $command->getName(),
                [
                    'args' => $input->getArguments(),
                    'options' => $input->getOptions(),
                    'trace' => $error->getTrace()[0],
                ]
            );

            $event->stopPropagation();
        }
    }
}
{'fraction_non_alphanumeric': 0.13777490297542044, 'fraction_numerical': 0.003234152652005175, 'mean_word_length': 2.25, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6957914', 'n_tokens_mistral': 401, 'n_tokens_neox': 385, 'n_words': 67}