-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[spiral/filters] Add error handling when performing casting #1016
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1016 +/- ##
============================================
+ Coverage 89.17% 89.21% +0.04%
- Complexity 6124 6146 +22
============================================
Files 808 810 +2
Lines 17307 17364 +57
============================================
+ Hits 15433 15492 +59
+ Misses 1874 1872 -2 ☔ View full report in Codecov by Sentry. |
|
||
public function __construct( | ||
protected ?string $message = null, | ||
?callable $callback = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add psalm annotation for closure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
It works as expected! |
What was changed
Added exception handling for errors occurring during value casting using
Spiral\Filters\Model\Mapper\EnumCaster
,Spiral\Filters\Model\Mapper\UuidCaster
, andSpiral\Filters\Model\Mapper\DefaultCaster
. Now, in the event of errors, aSpiral\Filters\Exception\SetterException
will be thrown.Introduced the
Spiral\Filters\Attribute\CastingErrorMessage
attribute, allowing the specification of an error message for enhanced error handling.