mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaObjectImports: add meaningful error...
...would have saved me some troubleshooting time
This commit is contained in:
parent
4d240976a3
commit
47bfb2d31d
@ -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…
x
Reference in New Issue
Block a user