N°4652 Better error message when XML node define fails from delta (#256)

N°4652 Add more details when trying to define an already existing XML node
Co-authored-by: Molkobain <guillaume.lajarige@combodo.com>
Co-authored-by: Pierre Goiffon <pierre.goiffon@combodo.com>
This commit is contained in:
Stephen Abello
2022-01-14 10:18:02 +01:00
committed by GitHub
parent 6c5ca614e0
commit 8ada56fc53

View File

@@ -2177,8 +2177,13 @@ class MFElement extends Combodo\iTop\DesignElement
if ($oExisting->getAttribute('_alteration') != 'removed') {
$sPath = MFDocument::GetItopNodePath($oNode);
$iLine = $oNode->getLineNo();
throw new MFException($sPath.' at line '.$iLine.": could not be added (already exists)", MFException::COULD_NOT_BE_ADDED,
$iLine, $sPath);
$sExistingPath = MFDocument::GetItopNodePath($oExisting);
$iExistingLine = $oExisting->getLineNo();
$sExceptionMessage = <<<EOF
`{$sPath}` at line {$iLine} could not be added : already exists in `{$sExistingPath}` at line {$iExistingLine}
EOF;
throw new MFException($sExceptionMessage, MFException::COULD_NOT_BE_ADDED, $iLine, $sPath);
}
$oExisting->ReplaceWithSingleNode($oNode);
$sFlag = 'replaced';