mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Leave original ValidationException intact in write()
If we want DataObject->validate() to be used instead of the form layer, we should allow for validation errors to be passed through unchanged to the controller layer so we can present them to the user. The context of which class is written should be apparent from the stacktrace of the exception.
This commit is contained in:
parent
3566581a86
commit
be5484b1d2
@ -1125,7 +1125,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
if (!$valid->valid()) {
|
if (!$valid->valid()) {
|
||||||
$writeException = new ValidationException(
|
$writeException = new ValidationException(
|
||||||
$valid,
|
$valid,
|
||||||
"Validation error writing a $this->class object: " . $valid->message() . ". Object not written.",
|
$valid->message(),
|
||||||
E_USER_WARNING
|
E_USER_WARNING
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user