Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
Expand Down Expand Up @@ -71,18 +70,7 @@ public function onMessageFailed(WorkerMessageFailedEvent $event)
$delay = $retryStrategy->getWaitingTime($envelope, $throwable);

if (null !== $this->logger) {
$logLevel = LogLevel::ERROR;
if ($throwable instanceof RecoverableExceptionInterface) {
$logLevel = LogLevel::WARNING;
} elseif ($throwable instanceof HandlerFailedException) {
foreach ($throwable->getNestedExceptions() as $nestedException) {
if ($nestedException instanceof RecoverableExceptionInterface) {
$logLevel = LogLevel::WARNING;
break;
}
}
}
$this->logger->log($logLevel, 'Error thrown while handling message {class}. Sending for retry #{retryCount} using {delay} ms delay. Error: "{error}"', $context + ['retryCount' => $retryCount, 'delay' => $delay, 'error' => $throwable->getMessage(), 'exception' => $throwable]);
$this->logger->warning('Error thrown while handling message {class}. Sending for retry #{retryCount} using {delay} ms delay. Error: "{error}"', $context + ['retryCount' => $retryCount, 'delay' => $delay, 'error' => $throwable->getMessage(), 'exception' => $throwable]);
}

// add the delay and retry stamp info
Expand Down