Skip to content

Commit c780f21

Browse files
committed
Improve PackingFailedException message
1 parent 13dd9be commit c780f21

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Exception/PackingFailedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PackingFailedException extends \RuntimeException
1818
*/
1919
public static function unsupportedType($value) : self
2020
{
21-
return new self(\sprintf('Unsupported type "%s", maybe you forgot to register the type transformer?',
21+
return new self(\sprintf('Unsupported type "%s", maybe you forgot to register the type transformer or extension?',
2222
\is_object($value) ? \get_class($value) : \gettype($value)
2323
));
2424
}

tests/Unit/PackerTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public function testPack($raw, string $packed) : void
4747
public function testPackThrowsExceptionOnUnsupportedType($value, string $type) : void
4848
{
4949
$this->expectException(PackingFailedException::class);
50-
$this->expectExceptionMessage("Unsupported type \"$type\", maybe you forgot to register the type transformer?");
50+
$this->expectExceptionMessage(
51+
"Unsupported type \"$type\", maybe you forgot to register the type transformer or extension?"
52+
);
5153

5254
$this->packer->pack($value);
5355
}
@@ -183,7 +185,9 @@ public function testPackThrowsExceptionOnUnsupportedCustomType() : void
183185
$packer = $this->packer->extendWith($transformer);
184186

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

188192
$packer->pack($obj);
189193
}

0 commit comments

Comments
 (0)