瀏覽代碼

XML Customizations: when the parent class is unknown, the error is "unknown constant PARENT_NOT_FOUND"... which is a clue ;-)... now it says something far more accurate like "/itop_design/classes/class[MyCustomClass] at line 458: parent class 'SomeOtherCustomClass' could not be found"

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4762 a333f486-631f-4898-b8df-5754b55c2be0
romainq 8 年之前
父節點
當前提交
d224a02ec0
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      setup/modelfactory.class.inc.php

+ 5 - 4
setup/modelfactory.class.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2016 Combodo SARL
+// Copyright (C) 2010-2017 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -19,7 +19,7 @@
 /**
  * ModelFactory: in-memory manipulation of the XML MetaModel
  *
- * @copyright   Copyright (C) 2010-2016 Combodo SARL
+ * @copyright   Copyright (C) 2010-2017 Combodo SARL
  * @license     http://opensource.org/licenses/AGPL-3.0
  */
 
@@ -54,7 +54,8 @@ class MFException extends Exception
 	const INVALID_DELTA = 5;
 	const ALREADY_DELETED = 6;
 	const NOT_FOUND = 7;
-	
+	const PARENT_NOT_FOUND = 8;
+
 	
 	public function __construct ($message = null, $code = null, $iSourceLineNumber = 0, $sXPath = '', $sExtraInfo = '', $previous = null)
 	{
@@ -474,7 +475,7 @@ class ModelFactory
 					$this->oDOMDocument->firstChild->Dump();
 					$sPath = MFDocument::GetItopNodePath($oSourceNode);
 					$iLine = $oSourceNode->getLineNo();
-					throw new MFException($sPath.' at line '.$iLine.": could not be found", MFException::PARENT_NOT_FOUND, $iLine, $sPath, $sParentId);
+					throw new MFException($sPath.' at line '.$iLine.": parent class '$sParentId' could not be found", MFException::PARENT_NOT_FOUND, $iLine, $sPath, $sParentId);
 				}
 			}
 			else