IcingaObject: improve error message

Complain about missing object_type, if assign-related properties cannot be
set because of that reason

refs #2142
This commit is contained in:
Thomas Gelf 2022-11-03 00:20:30 +01:00
parent 693b8fe317
commit 63d76abf81
1 changed files with 6 additions and 1 deletions

View File

@ -497,9 +497,14 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$type = get_class($this);
}
if ($type === null) {
throw new LogicException(
'Cannot set assign_filter unless object_type has been set'
);
}
throw new LogicException(sprintf(
'I can only assign for applied objects or objects with native'
. ' support for assigments, got %s',
. ' support for assignments, got %s',
$type
));
}