Skip to content

Commit 97e3fea

Browse files
committed
[Messenger] add handler description as array key to HandlerFailedException::getNestedExceptions()
1 parent f0959b4 commit 97e3fea

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/Symfony/Component/Messenger/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Deprecate `StopWorkerOnSignalsListener` in favor of using the `SignalableCommandInterface`
88
* Add `HandlerDescriptor::getOptions`
9+
* Add handler description as array key to `HandlerFailedException::getNestedExceptions()`
910

1011
6.3
1112
---

src/Symfony/Component/Messenger/Exception/HandlerFailedException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class HandlerFailedException extends RuntimeException
1919
private Envelope $envelope;
2020

2121
/**
22-
* @param \Throwable[] $exceptions
22+
* @param array<string,\Throwable> $exceptions
2323
*/
2424
public function __construct(Envelope $envelope, array $exceptions)
2525
{
@@ -46,7 +46,7 @@ public function getEnvelope(): Envelope
4646
}
4747

4848
/**
49-
* @return \Throwable[]
49+
* @return array<string,\Throwable>
5050
*/
5151
public function getNestedExceptions(): array
5252
{

src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
9595
$envelope = $envelope->with($handledStamp);
9696
$this->logger?->info('Message {class} handled by {handler}', $context + ['handler' => $handledStamp->getHandlerName()]);
9797
} catch (\Throwable $e) {
98-
$exceptions[] = $e;
98+
$exceptions[$handlerDescriptor->getName()] = $e;
9999
}
100100
}
101101

@@ -107,7 +107,7 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
107107
$handler = $stamp->getHandlerDescriptor()->getBatchHandler();
108108
$handler->flush($flushStamp->force());
109109
} catch (\Throwable $e) {
110-
$exceptions[] = $e;
110+
$exceptions[$stamp->getHandlerDescriptor()->getName()] = $e;
111111
}
112112
}
113113
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy