-
Notifications
You must be signed in to change notification settings - Fork 17
Enhanced exception for createContent #670
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
base: 4.6
Are you sure you want to change the base?
Conversation
|
alongosz
left a comment
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.
The reason we didn't push for this change here and in the other places was BC concern. As you can see yourself, the matching pattern of a message slightly changes. It's likely that UI translations would require regenerating (there's no test for that due to technical challenges).
I'm not saying no. After all it's an improvement and BC concern touches mostly both 1st party (easy to check) and 3rd party E2E coverage.
However, what are the implications for the UI? Meaning how does this show up in the interface?
| { | ||
| $this->expectException(ContentFieldValidationException::class); | ||
| $this->expectExceptionMessage('Content fields did not validate'); | ||
| $this->expectExceptionMessage('Content "" fields did not validate'); |
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.
This is concerning. Is there no content name at this stage due to business logic or mocking?
Side note: this code is most likely a result of few automated refactoring. If you're touching this, both expectException and expectExceptionMessage should be moved right before the statement which produces the exception.
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.
However, what are the implications for the UI? Meaning how does this show up in the interface?
I don't think it is shown in the UI at all.
Error is thrown when creating content
# [src/lib/Repository/ContentService->createContent()
$errors = $this->validate(
$contentCreateStruct,
[],
$fieldIdentifiersToValidate
);
if (!empty($errors)) {
- throw new ContentFieldValidationException($errors);
+ throw ContentFieldValidationException::createNewWithMultiline($errors);
}
At this stage we only have $contentCreateStruct - nothing is persisted - we do not have a ContentName yet.
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.
But I see the BC concerns.



PR adds enhanced exception handling to
contentCreate(
ContentFieldValidationException::createNewWithMultiline($errors)was introduced in ezsystems/ezplatform-kernel#329)Without PR, thrown errors will show up as :
With PR, details regarding affected fields will be shown: