From b88609ca2e240ccd7bfaa9f35bac1694b6757bdb Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 22 Jun 2021 20:25:05 +0200 Subject: [PATCH] Improve error messages while saving a new Agent entity --- pandora_console/include/lib/Agent.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Agent.php b/pandora_console/include/lib/Agent.php index 0063b071b8..c71d8415ce 100644 --- a/pandora_console/include/lib/Agent.php +++ b/pandora_console/include/lib/Agent.php @@ -219,8 +219,19 @@ class Agent extends Entity if ($rs === false) { global $config; + $error = $config['dbconnection']->error; + if (empty($error) === true) { + if (empty($updates['intervalo']) === true) { + $error = 'Missing agent interval'; + } else if (empty($updates['id_group']) === true) { + $error = 'Missing id_group'; + } else if (empty($updates['id_group']) === true) { + $error = 'Missing id_group'; + } + } + throw new \Exception( - __METHOD__.' error: '.$config['dbconnection']->error + __METHOD__.' error: '.$error ); }