Skip to content

Commit

Permalink
improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Aug 10, 2024
1 parent 6dcb105 commit 0566adb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function process(ContainerBuilder $container): void
if (!$this->allowMultiple) {
foreach ($handlers as $class => $refs) {
if (count($refs) > 1) {
throw new LogicException(sprintf('Only one handler is allowed for %s of type "%s".', $this->topic, $class));
throw new LogicException(sprintf('Only one handler is allowed for %s of type "%s". However, %d were found: %s', $this->topic, $class, count($refs), implode(', ', $refs)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testMultipleMessageHandlingProcess(): void
public function testInvalidSingleMessageHandlingProcess(): void
{
$this->expectException(LogicException::class);
$this->expectExceptionMessage('Only one handler is allowed for message of type "OpenSolid\Tests\Bus\Fixtures\MyMessage".');
$this->expectExceptionMessage('Only one handler is allowed for message of type "OpenSolid\Tests\Bus\Fixtures\MyMessage". However, 2 were found: handler_1, handler_2');

$container = new ContainerBuilder();
$this->configureContainer($container, allowMultiple: false);
Expand Down

0 comments on commit 0566adb

Please sign in to comment.