/**
  * The constructor for the exception that sets up the exception and the Error class.
  * 
  * @access public
  * @param string $message The error message or the key matching a registered error
  * @param mixed $params The error params or the error code
  */
 public function __construct($message, $params = 0)
 {
     $code = null;
     if (!is_array($params) && $params != 0) {
         $params = array('code' => $params);
     }
     // call hook
     Hook::call('Exeception.construct', array(&$message, &$params));
     if ($error = Config::getError($message)) {
         if (isset($error['messageArgs']) && isset($params['messageArgs'])) {
             $params['messageArgs'] = array_merge($error['messageArgs'], $params['messageArgs']);
         }
         $params = array_merge($error, (array) $params);
         $message = $params['message'];
         if (isset($params['code'])) {
             $code = $params['code'];
         }
     }
     if (isset($params['messageArgs']) && is_array($params['messageArgs'])) {
         $message = $this->dsprintf($message, $params['messageArgs']);
     }
     $this->params = (array) $params;
     parent::__construct($message, is_long($code) ? $code : null);
     Error::setupError($this);
 }