Skip to content

Commit fefb1b1

Browse files
authored
Merge pull request #2 from andrew-demb/catch-type-error
Catch more specific error, expand tracked message
2 parents 0e94b83 + 7d51fa0 commit fefb1b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Extensions/PropertyNormalizerWrapper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function extractAttributes(object $object, string $format = null, arra
6060
/**
6161
* {@inheritdoc}
6262
*
63-
* @throws \Throwable
63+
* @throws \Error
6464
*/
6565
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = [])
6666
{
@@ -73,14 +73,14 @@ protected function getAttributeValue(object $object, string $attribute, string $
7373
{
7474
return parent::getAttributeValue($object, $attribute, $format, $context);
7575
}
76-
catch (\Throwable $throwable)
76+
catch (\Error $error)
7777
{
78-
if (\strpos($throwable->getMessage(), 'before initialization') !== false)
78+
if (\strpos($error->getMessage(), 'must not be accessed before initialization') !== false)
7979
{
8080
return null;
8181
}
8282

83-
throw $throwable;
83+
throw $error;
8484
}
8585
}
8686

0 commit comments

Comments
 (0)