Error return

This commit is contained in:
Eric Espie
2026-01-29 10:50:58 +01:00
parent d7451fe2ea
commit 3aba8c5aa3

View File

@@ -34,6 +34,9 @@ class PropertyTypeCompiler
*/
public function CompilePropertyTypeFromXML(string $sXMLContent): PropertyType
{
if (!utils::StartsWith($sXMLContent, '<?xml version="1.0" encoding="UTF-8"?>')) {
throw new PropertyTypeCompilerException('Property types definition should be XML file');
}
$oDoc = new DesignDocument();
libxml_clear_errors();
$oDoc->loadXML($sXMLContent);
@@ -45,6 +48,10 @@ class PropertyTypeCompiler
/** @var \Combodo\iTop\DesignElement $oRoot */
$oRoot = $oDoc->firstChild;
if (!$oRoot) {
throw new PropertyTypeCompilerException('Property types definition not correctly formatted!');
}
return PropertyTypeFactory::GetInstance()->CreatePropertyTypeFromDom($oRoot);
}