From 9b5d0a9495625fb446b0db00923202c3f09ed788 Mon Sep 17 00:00:00 2001 From: David Badura Date: Thu, 25 Jan 2024 16:42:41 +0100 Subject: [PATCH] add missing exception message --- src/Metadata/AggregateRoot/ClassIsNotAnAggregate.php | 7 +++++++ src/Metadata/Event/ClassIsNotAnEvent.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/Metadata/AggregateRoot/ClassIsNotAnAggregate.php b/src/Metadata/AggregateRoot/ClassIsNotAnAggregate.php index 4cf9b48f8..162015baa 100644 --- a/src/Metadata/AggregateRoot/ClassIsNotAnAggregate.php +++ b/src/Metadata/AggregateRoot/ClassIsNotAnAggregate.php @@ -6,6 +6,13 @@ use Patchlevel\EventSourcing\Metadata\MetadataException; +use function sprintf; + final class ClassIsNotAnAggregate extends MetadataException { + /** @param class-string $class */ + public function __construct(string $class) + { + parent::__construct(sprintf('class %s is not an aggregate root', $class)); + } } diff --git a/src/Metadata/Event/ClassIsNotAnEvent.php b/src/Metadata/Event/ClassIsNotAnEvent.php index 76a77c2a7..c9c78ab24 100644 --- a/src/Metadata/Event/ClassIsNotAnEvent.php +++ b/src/Metadata/Event/ClassIsNotAnEvent.php @@ -6,6 +6,13 @@ use Patchlevel\EventSourcing\Metadata\MetadataException; +use function sprintf; + final class ClassIsNotAnEvent extends MetadataException { + /** @param class-string $class */ + public function __construct(string $class) + { + parent::__construct(sprintf('class %s is not an event', $class)); + } }