예제 #1
0
파일: NotFound.php 프로젝트: evltuma/moodle
 /**
  * Constructor.
  *
  * @see Horde_Exception::__construct()
  *
  * @param mixed $message           The exception message, a PEAR_Error
  *                                 object, or an Exception object.
  * @param integer $code            A numeric error code.
  */
 public function __construct($message = null, $code = null)
 {
     if (is_null($message)) {
         $message = Horde_Exception_Translation::t("Not Found");
     }
     parent::__construct($message, $code);
 }
예제 #2
0
 /**
  * Exception constructor.
  *
  * @param PEAR_Error $error The PEAR error.
  */
 public function __construct(PEAR_Error $error)
 {
     parent::__construct($error->getMessage() . $this->_getPearTrace($error), $error->getCode());
     if ($details = $error->getUserInfo()) {
         $this->details = $details;
     }
 }
예제 #3
0
 /**
  * Exception constructor
  *
  * If $lasterror is passed the return value of error_get_last() (or a
  * matching format), the exception will be rewritten to have its file and
  * line parameters match that of the array, and any message in the array
  * will be appended to $message.
  *
  * @param mixed $message             The exception message, a PEAR_Error
  *                                   object, or an Exception object.
  * @param mixed $code_or_lasterror   Either a numeric error code, or
  *                                   an array from error_get_last().
  */
 public function __construct($message = null, $code_or_lasterror = null)
 {
     if (is_array($code_or_lasterror)) {
         if ($message) {
             $message .= $code_or_lasterror['message'];
         } else {
             $message = $code_or_lasterror['message'];
         }
         parent::__construct($message, $code_or_lasterror['type']);
         $this->file = $code_or_lasterror['file'];
         $this->line = $code_or_lasterror['line'];
     } else {
         parent::__construct($message, $code_or_lasterror);
     }
 }
예제 #4
0
 /**
  * Exception constructor.
  *
  * @param mixed $message The exception message, a PEAR_Error
  *                       object, or an Exception object.
  * @param int   $code    A numeric error code.
  */
 public function __construct($message = null, $code = 0)
 {
     $previous = null;
     if (is_object($message) && method_exists($message, 'getMessage')) {
         if (empty($code) && method_exists($message, 'getCode')) {
             $code = $message->getCode();
         }
         if ($message instanceof Exception) {
             $previous = $message;
         }
         if (method_exists($message, 'getUserinfo') && ($details = $message->getUserinfo())) {
             $this->details = $details;
         }
         $message = $message->getMessage();
     }
     parent::__construct($message, $code, $previous);
 }
예제 #5
0
 /**
  * Constructor.
  *
  * @param string $msg  Error message (non-translated).
  * @param code $code   Error code.
  */
 public function __construct($message = null, $code = null)
 {
     parent::__construct(Horde_Smtp_Translation::t($message), $code);
     $this->_rawmsg = $message;
 }
예제 #6
0
 public function testMethodGetpreviousYieldsPreviousException()
 {
     $e = new Horde_Exception(null, null, new Exception('previous'));
     $this->assertEquals('previous', $e->getPrevious()->getMessage());
 }
예제 #7
0
파일: Pear.php 프로젝트: evltuma/moodle
 /**
  * Exception constructor.
  *
  * @param PEAR_Error $error The PEAR error.
  */
 public function __construct(PEAR_Error $error)
 {
     parent::__construct($error->getMessage(), $error->getCode());
     $this->details = $this->_getPearTrace($error);
 }