Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-32378

Make it easier to extract the error message from ContentFieldValidationException errors

    XMLWordPrintable

Details

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            72f8acac-185f-4a54-9470-a7473f50daab@accounts.ibexa.co Gaetano Giunta
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: