Skip to content

Commit

Permalink
Fixed error messages in NotificationEventSubscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
tg666 committed Apr 30, 2022
1 parent b119a9a commit 0918085
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/EventSubscriber/NotificationEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,11 @@ private function createErrorNotificationBuilder(string $messageBase, ExceptionIn
{
$notifier = $this->getNotifier();

if ($e instanceof TranslatableException) {
return $notifier->error($messageBase . '.' . $e->getMessage(), $e->getArgs());
if ($e instanceof TranslatableException || $e->getPrevious() instanceof TranslatableException) {
$translatableException = $e instanceof TranslatableException ? $e : $e->getPrevious();
assert($translatableException instanceof TranslatableException);

return $notifier->error($messageBase . '.' . $translatableException->getMessage(), $translatableException->getArgs());
}

return $notifier->error($messageBase . '.default', [
Expand Down

0 comments on commit 0918085

Please sign in to comment.