function relation_save($relation) {
try {
field_attach_validate('relation', $relation);
}
catch (FieldValidationException $e) {
// ??? message
return FALSE;
}
...
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | field_validation_error-1362304-5.patch | 473 bytes | mikran |
| #3 | field_validation_error-1362304-3.patch | 472 bytes | mikran |
Comments
Comment #1
toolin commentedThis seems to me a pretty significant issue - a validation error causes relation_save() to silently fail.
There may be other plans for validation, but for now simply re-throwing the exception would be an improvement.
For anyone who encounters this, a FieldValidationException has an attribute errors, an array of error codes and messages. So to see what went wrong look at $e->errors . You need to hack the code in relation.module to re-throw the exception like this:
Comment #2
matglas86 commentedThis bug is mentioned here #1395092: Relation fields not getting saved and here #1350588: relation_endpoint_field_validate() should also check if entity is_new when testing if the relation is unique. The last issue is visually affected by it. This needs to be fixed for experience use at least. Maybe just a drupal_set_message() to mention what went wrong.
Comment #3
mikran commentedThe attached patch adds watchdog error.
Comment #5
mikran commentedtypo.
Comment #6
mikran commentedPatch committed
Comment #8
aaronbaumanSo, now we're successfully logging that an exception occurred, but not actually logging the exception message.
Comment #9
aaronbaumanNevermind, I see the exception message is no more descriptive either.