Errors from Symfony's PropertyAccessor now result in Purgatory's PropertyNotAccessibleException#110
Open
klezaic wants to merge 9 commits intosofascore:2.xfrom
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.x #110 +/- ##
============================================
+ Coverage 96.97% 97.13% +0.16%
- Complexity 491 495 +4
============================================
Files 62 62
Lines 1454 1466 +12
============================================
+ Hits 1410 1424 +14
+ Misses 44 42 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Brajk19
reviewed
Jul 1, 2025
Comment on lines
38
to
42
| } catch (\InvalidArgumentException|AccessException|UnexpectedTypeException) { | ||
| throw new PropertyNotAccessibleException( | ||
| \is_array($objectOrArray) ? 'array' : $objectOrArray::class, | ||
| (string) $propertyPath, | ||
| ); |
Member
There was a problem hiding this comment.
we should probably add previous throwable to PropertyNotAccessibleException so we don't lose error context from property accessor
| $this->expectException(PropertyNotAccessibleException::class); | ||
| $this->expectExceptionMessage( | ||
| \sprintf( | ||
| 'Unable to create a getter for property "%s::%s".', |
Member
There was a problem hiding this comment.
not sure about this message, it fits the context it was used for previously, but i don't think is good for errors with property accessor.
maybe we should change the message? @HypeMC
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Symfony's
PropertyAccessorfails to get a property value, whether due to an incorrect argument provided to the method, a non-existent property, or a property with insufficient visibility, one of exceptions will be thrown:InvalidArgumentException,AccessException,UnexpectedTypeExceptionSince Symfony's
PropertyAccessoris used by many other bundles, and often in projects codebase directly, seeing this exception in logs doesn't immediately indicate that error occurred in Purgatory.To improve visibility and observability when these errors occur, we are re-throwing the PropertyAccessor's exception as
PropertyNotAccessibleExceptionwhich is specific to the Purgatory bundle.