-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
254d3f1
commit 3b27e06
Showing
5 changed files
with
104 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\EventBus\Serializer; | ||
|
||
use Patchlevel\EventSourcing\EventBus\Message; | ||
use RuntimeException; | ||
|
||
use function get_debug_type; | ||
use function sprintf; | ||
|
||
final class DeserializeFailed extends RuntimeException | ||
{ | ||
public static function decodeFailed(): self | ||
{ | ||
return new self('Error while decoding message'); | ||
} | ||
|
||
public static function invalidMessage(mixed $value): self | ||
{ | ||
return new self( | ||
sprintf( | ||
'Value should me an instance of %s, but is %s', | ||
Message::class, | ||
get_debug_type($value), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Outbox; | ||
|
||
use RuntimeException; | ||
|
||
use function gettype; | ||
use function sprintf; | ||
|
||
final class OutboxHeaderIssue extends RuntimeException | ||
{ | ||
public static function missingHeader(string $header): self | ||
{ | ||
return new self(sprintf('missing header "%s"', $header)); | ||
} | ||
|
||
public static function invalidHeaderType(mixed $value): self | ||
{ | ||
return new self(sprintf('Invalid header given: need type "int" got "%s"', gettype($value))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters