From 8ada56fc53cbc0f4cdf700ec226da670ddc951d4 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Fri, 14 Jan 2022 10:18:02 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04652=20Better=20error=20message=20when?= =?UTF-8?q?=20XML=20node=20define=20fails=20from=20delta=20(#256)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit N°4652 Add more details when trying to define an already existing XML node Co-authored-by: Molkobain Co-authored-by: Pierre Goiffon --- setup/modelfactory.class.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup/modelfactory.class.inc.php b/setup/modelfactory.class.inc.php index d4b93d7f5..90df6f8c9 100644 --- a/setup/modelfactory.class.inc.php +++ b/setup/modelfactory.class.inc.php @@ -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 = <<ReplaceWithSingleNode($oNode); $sFlag = 'replaced';