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
Improving exception msgs for database types #11764
Conversation
throw new InvalidArgumentException('Cannot convert value to bool'); | ||
throw new InvalidArgumentException(sprintf( | ||
'Cannot convert value of type `%s` to bool', | ||
getTypeName($value) |
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.
Wouldnt it then also make sense to include the value itself directly? Or is that a bit too much then as debug info?
'Cannot convert value `%s` of type `%s` to bool'
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.
I wanted to do that, but how could we archive this? It's just the base \InvalidArgumentException and doesn't really have a way to attach arbitrary data to it? Also does the error renderer has the capability of showing that value? Especially in this case of wrong type values, know the content of $value
would make debugging the cause extremely helpful.
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.
Yeah, maybe a bit out of scope - or even overkill - to use some Debugger::exportVar($x, 0).
Hopefully the stracktrace contains the caller arguments.
Codecov Report
@@ Coverage Diff @@
## 3.next #11764 +/- ##
============================================
+ Coverage 91.91% 91.92% +<.01%
Complexity 13293 13293
============================================
Files 463 463
Lines 34164 34172 +8
============================================
+ Hits 31403 31411 +8
Misses 2761 2761
Continue to review full report at Codecov.
|
Nice improvement 👏 |
It's annoying that you can't see the type and make a guess which of the many values it might be.