Improve error messages while saving a new Agent entity

This commit is contained in:
fbsanchez 2021-06-22 20:25:05 +02:00
parent 9fb7074082
commit b88609ca2e
1 changed files with 12 additions and 1 deletions

View File

@ -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
);
}