Skip to content

Commit

Permalink
Improve PackingFailedException message
Browse files Browse the repository at this point in the history
  • Loading branch information
rybakit committed Oct 25, 2021
1 parent 13dd9be commit c780f21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Exception/PackingFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PackingFailedException extends \RuntimeException
*/
public static function unsupportedType($value) : self
{
return new self(\sprintf('Unsupported type "%s", maybe you forgot to register the type transformer?',
return new self(\sprintf('Unsupported type "%s", maybe you forgot to register the type transformer or extension?',
\is_object($value) ? \get_class($value) : \gettype($value)
));
}
Expand Down
8 changes: 6 additions & 2 deletions tests/Unit/PackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public function testPack($raw, string $packed) : void
public function testPackThrowsExceptionOnUnsupportedType($value, string $type) : void
{
$this->expectException(PackingFailedException::class);
$this->expectExceptionMessage("Unsupported type \"$type\", maybe you forgot to register the type transformer?");
$this->expectExceptionMessage(
"Unsupported type \"$type\", maybe you forgot to register the type transformer or extension?"
);

$this->packer->pack($value);
}
Expand Down Expand Up @@ -183,7 +185,9 @@ public function testPackThrowsExceptionOnUnsupportedCustomType() : void
$packer = $this->packer->extendWith($transformer);

$this->expectException(PackingFailedException::class);
$this->expectExceptionMessage('Unsupported type "stdClass", maybe you forgot to register the type transformer?');
$this->expectExceptionMessage(
'Unsupported type "stdClass", maybe you forgot to register the type transformer or extension?'
);

$packer->pack($obj);
}
Expand Down

0 comments on commit c780f21

Please sign in to comment.