mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
MVC / Core - when throwing Validation\Exception, make sure to add the current field contents when we can find it. This improves model migration log output and helps debugging issues. related to https://github.com/opnsense/core/issues/5693
This commit is contained in:
parent
714eca2b18
commit
626c3dbf55
@ -568,6 +568,10 @@ abstract class BaseModel
|
||||
foreach ($messages as $msg) {
|
||||
$exception_msg_part = "[" . get_class($this) . ":" . $msg->getField() . "] ";
|
||||
$exception_msg_part .= $msg->getMessage();
|
||||
$field_value = $this->getNodeByReference($msg->getField());
|
||||
if (!empty($field_value)) {
|
||||
$exception_msg_part .= sprintf("{%s}", $field_value);
|
||||
}
|
||||
$exception_msg .= "$exception_msg_part\n";
|
||||
// always log validation errors
|
||||
$logger->error($exception_msg_part);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user