Procházet zdrojové kódy

DOMFormatException : Overloaded the constructor to add an optionnal parameter $node (\DOMNode) that will append informations about the node and the exception line number to $message.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3842 a333f486-631f-4898-b8df-5754b55c2be0
glajarige před 9 roky
rodič
revize
f45d552a7c
1 změnil soubory, kde provedl 17 přidání a 0 odebrání
  1. 17 0
      setup/compiler.class.inc.php

+ 17 - 0
setup/compiler.class.inc.php

@@ -18,11 +18,28 @@
 
 
 require_once(APPROOT.'setup/setuputils.class.inc.php');
+require_once(APPROOT.'setup/modelfactory.class.inc.php');
 require_once(APPROOT.'core/moduledesign.class.inc.php');
 
 
 class DOMFormatException extends Exception
 {
+    /**
+     * Overrides the Exception default constructor to automatically add informations about the concerned node (path and line number)
+     * 
+     * @param string $message
+     * @param type $code
+     * @param type $previous
+     * @param DOMNode $node [Optionnal] DOMNode causing the DOMFormatException
+     */
+    public function __construct($message, $code, $previous, DOMNode $node = null)
+    {
+        if($node !== null)
+        {
+            $message .= ' ('.MFDocument::GetItopNodePath($node).' at line '.$node->getLineNo().')';
+        }
+        parent::__construct($message, $code, $previous);
+    }
 }
 
 /**