mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2026-05-28 04:35:53 -04:00
IcingaObjectImports: add meaningful error...
...would have saved me some troubleshooting time
This commit is contained in:
parent
4d240976a3
commit
47bfb2d31d
1 changed files with 10 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Objects;
|
|||
|
||||
use Countable;
|
||||
use Exception;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Iterator;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
||||
|
|
@ -289,7 +290,15 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||
return true;
|
||||
}
|
||||
|
||||
$objectId = (int) $this->object->get('id');
|
||||
$objectId = $this->object->get('id');
|
||||
if ($objectId === null) {
|
||||
throw new ProgrammingError(
|
||||
'Cannot store imports for unstored object with no ID'
|
||||
);
|
||||
} else {
|
||||
$objectId = (int) $objectId;
|
||||
}
|
||||
|
||||
$type = $this->getType();
|
||||
|
||||
$objectCol = $type . '_id';
|
||||
|
|
|
|||
Loading…
Reference in a new issue