From dda8e84b12f772dbcdbfa63dd892ad7c68304593 Mon Sep 17 00:00:00 2001 From: Saidi Date: Thu, 26 Sep 2024 11:23:53 +0200 Subject: [PATCH] ignore error 404 for alert email #3101 --- src/EventListener/ExceptionListener.php | 3 ++- src/Service/Mailer/Mail/Error/ErrorSignalementMailer.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EventListener/ExceptionListener.php b/src/EventListener/ExceptionListener.php index 8c240171d..d84977fa0 100755 --- a/src/EventListener/ExceptionListener.php +++ b/src/EventListener/ExceptionListener.php @@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\ExceptionEvent; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Serializer\Exception\NotEncodableValueException; @@ -37,7 +38,7 @@ public function onKernelException(ExceptionEvent $event): void $event->setResponse($response); } - if (!$exception instanceof MethodNotAllowedException) { + if (!$exception instanceof MethodNotAllowedException && !$exception instanceof NotFoundHttpException) { $this->notificationMailerRegistry->send( new NotificationMail( type: NotificationMailerType::TYPE_ERROR_SIGNALEMENT, diff --git a/src/Service/Mailer/Mail/Error/ErrorSignalementMailer.php b/src/Service/Mailer/Mail/Error/ErrorSignalementMailer.php index 45b50c527..a397b7a65 100644 --- a/src/Service/Mailer/Mail/Error/ErrorSignalementMailer.php +++ b/src/Service/Mailer/Mail/Error/ErrorSignalementMailer.php @@ -13,7 +13,7 @@ class ErrorSignalementMailer extends AbstractNotificationMailer { protected ?NotificationMailerType $mailerType = NotificationMailerType::TYPE_ERROR_SIGNALEMENT; - protected ?string $mailerSubject = 'Une erreur est survenue lors de la création d\'un signalement !'; + protected ?string $mailerSubject = 'Une erreur est survenue !'; protected ?string $mailerTemplate = 'erreur_signalement_email'; public function __construct(