Details
-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
Description
It is quite common in eZPlatform applications to have command-line scripts which create or update content, or to do the same in custom controllers or event handlers.
When a content validation rule fails, the content is not created/updated, and a ContentFieldValidationException exception is thrown.
The default end-user error-handling code would then display $e->getMessage(); but this is not very helpful in this case, as the error message is generic, and it carries no information about which fields did not validate or why.
I have coded multiple times functions which loop over the exception data, relate it to data from the ContentType service and piece together a useful error message.
I think that it would be good if such a bit of code would made available as part of the base offer, to avoid the effort of reimplementing it poorly multiple times.