TException is the base class for all PRADO exceptions. TException provides the functionality of translating an error code into a descriptive error message in a language that is preferred by user browser. Additional parameters may be passed together with the error code so that the translated message contains more detailed information. By default, TException looks for a message file by calling {@link getErrorMessageFile()} method, which uses the "message-xx.txt" file located under "System.Exceptions" folder, where "xx" is the code of the user preferred language. If such a file is not found, "message.txt" will be used instead.
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends Exception
Esempio n. 1
0
 /**
  * Constructor, similar to the parent constructor. For parameters that
  * are of SimpleXmlElement, the tag name and its attribute names and values
  * are expanded into a string.
  */
 public function __construct($errorMessage)
 {
     $this->setErrorCode($errorMessage);
     $errorMessage = $this->translateErrorMessage($errorMessage);
     $args = func_get_args();
     array_shift($args);
     $n = count($args);
     $tokens = array();
     for ($i = 0; $i < $n; ++$i) {
         if ($args[$i] instanceof SimpleXMLElement) {
             $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]);
         } else {
             $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]);
         }
     }
     parent::__construct(strtr($errorMessage, $tokens));
 }
Esempio n. 2
0
 public function __construct($message, $errorCode = -1)
 {
     $this->setErrorCode($errorCode);
     parent::__construct($message);
 }