RFC: Injected previous exception into field validation exception #393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Question after reading this: Does this provide enough value?
Description:
Note
The issue in ibexa/migrations, which I was trying to fix, actually no longer exists on 4.x - by accident - due to https://github.com/ibexa/migrations/pull/338. However I still believe this change presents some minor value.
Background
OOTB validation message returned by
ContentFieldValidationException::getMessage
states"Content fields did not validate"
.To avoid lack of verbosity here (user doesn't know where the error actually is) we have there static method
createNewWithMultiline
,however it still needs to be called explicitly when handling the exception thrown from some places, while in other places it has been wrapped already. Leaving this as-is due to BC.
Fix
This PR adds the possibility to include previous exception thrown when building new one using
ContentFieldValidationException::createNewWithMultiline
. Seems it is more correct to do:however due to the mentioned migrations fix, provides little actual value - just improving here the exception API itself.
Ideally I would do:
but that can't be done due to BC.
Additionally I've fixed broken PHPDoc for
ContentService::publishVersion
. Long time ago we've added the possibility to validate a content item during publishing instead of a create/update operation, but seems we've forgotten to document an exception that can be thrown.For QA:
Not reproducible on 4.6 due to the mentioned migrations fix.
Documentation:
Rest API reference change for 4.6, not sure if extra doc action is needed here.