-
-
Notifications
You must be signed in to change notification settings - Fork 958
Enhance exception message for non-object relation #7646
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
Conversation
|
|
||
| if (!\is_object($attributeValue) && null !== $attributeValue) { | ||
| throw new UnexpectedValueException('Unexpected non-object value for to-one relation.'); | ||
| throw new UnexpectedValueException('Unexpected non-object value for to-one relation on class `'.$object::class.'` for attribute `'.$attribute.'`.'); |
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.
isn't this exposing too much information?
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.
By which you're referring to security related concerns? Disabling showing errors in prod environments imo is a userland concern, implying that exception messages can't be extensive and clear enough. The current message does not really help much in solving the issue.
|
The actual root cause of the issue was an entity having a #[ApiResource]
class Foo {
private Bar $bar;
public function isBar(): bool
{
// ...
}
}with the change of this PR would lead to |
|
not sure, probably it should be |
|
@soyuka ✅ rebase and targeting 4.2 |
|
thanks! |
Did receive this exception in an environment out of my control, and message was not helping sufficiently with root cause analysis.