public function testToHtml() { $e = new PEAR_Exception('oops'); $html = $e->toHtml(); $this->assertInternalType('string', $html); $this->assertContains('oops', $html); }
/** * * * @override * @return array */ public function getTraceSafe() { if (count($this->_outerTrace) > 0) { return $this->_outerTrace; } return parent::getTraceSafe(); }
/** * __construct * * @param string $message An error message. * @param mixed $code An error code. * @param mixed $exception The previous exception, when we re-throw [optional] * * @uses parent::__construct() * @uses self::$exceptionStack */ public function __construct($message, $code = null, $exception = null) { if ($exception !== null) { array_push($this->exceptionStack, $exception); } parent::__construct($message, $code); }
/** * Triggers the exception. * * @param mixed $exception the exception ID and optional message part, * e.g. "string" or array("invalid", '--foo') * @return void * @access public */ public function __construct($exception) { // extracts the exception ID and message parameters settype($exception, 'array'); $id = current($exception); // resets the exception ID if no corresponding message (programmatic error!) isset($this->messages[$id]) or $exception = array(null, $id) and $id = 'unknow'; // extracts the exception code and pattern list($code, $format) = $this->messages[$id]; $exception[0] = $format; // completes the message, throws the exception $message = call_user_func_array('sprintf', $exception); parent::__construct($message, $code); }
public function __construct($message, $error_code = 0, $errorData = array(), $previous = null) { parent::__construct(ts($message)); $this->errorData = $errorData + array('error_code' => $error_code); }
/** * Constructor method * * @param string $message The error message. * @param Exception $exception The Exception that caused this exception * to be thrown. This argument is optional. */ public function __construct($message, $exception = null) { parent::__construct($message, $exception); }
/** * Constructor method * * @param string $message The error message. */ public function __construct($message) { parent::__construct($message); }
/** * __construct * * @access public * @param string $message The error message * @param int $code The error code * @return void */ public function __construct($message, $code = 0) { $this->message = $message; $this->code = $code; parent::__construct($message, $code); }
public function __construct($message = null, $code = 0, $lastCall = '') { parent::__construct($message, $code); $this->lastCall = $lastCall; }
public function __construct($message = null, $e = null, $code = 0) { $message = ($message ? "{$message}\n" : "") . "\$_SERVER:" . json_encode($_SERVER) . ";\$_GET:" . json_encode($_GET) . ";\$_POST:" . json_encode($_POST) . ";\$_COOKIE:" . json_encode($_COOKIE) . ";\$_FILES:" . json_encode($_FILES) . ";REQUEST_HEADERS:" . json_encode(function_exists("apache_request_headers") ? apache_request_headers() : array()); parent::__construct($message, $e, $code); }
/** * Constructor. * * @param string|HTTP_Request $messageOrResponse a string (UTF-8) describing * the error, or the * HTTP_Request2_Response that * caused the exception. * @param int $code the error code. */ public function __construct($messageOrResponse, $code = 0) { $message = false; if ($messageOrResponse instanceof HTTP_Request2_Response) { $this->response = $messageOrResponse; $contentType = $this->response->getHeader('content-type'); if ($contentType == 'application/xml' && $this->response->getBody()) { $prevUseInternalErrors = libxml_use_internal_errors(true); $doc = new DOMDocument(); $ok = $doc->loadXML($this->response->getBody()); libxml_use_internal_errors($prevUseInternalErrors); if ($ok) { $xPath = new DOMXPath($doc); $this->_amazonErrorCode = $xPath->evaluate('string(/Error/Code)'); $message = $xPath->evaluate('string(/Error/Message)'); } } if (!$message) { $message = 'Bad response from server.'; } if (!$code) { $code = $this->response->getStatus(); } } else { $message = (string) $messageOrResponse; } parent::__construct($message, $code); }
public function __construct($message, $p2 = null, $p3 = null) { parent::__construct($message, $p2, $p3); throw $this; }
/** * Constructor * * @param string $message Error message * @param integer $code Error code * @param string $call API call that generated error * @param string $response The raw response that produced the erorr * * @see Services_Twitter_Exception::$call * @link http://php.net/exceptions */ public function __construct($message = null, $code = 0, $call = '', $response = '') { parent::__construct($message, $code); $this->call = $call; $this->response = $response; }
function __construct() { PEAR_Exception::addObserver(array($this, "notifyError")); }
/** * Stores the HTTP Status code in addition to the exception message and code * * @param string $message Exception message * @param int $code Exception code * @param int $status HTTP status code * * @return void */ public function __construct($message = '', $code = 0, $status = 0) { $this->status = $status; parent::__construct($message, $code); }
/** * Creates a new invalid comment exception * * @param string $message the error message. * @param integer $code the error code. * @param Services_Akismet2_Comment $comment the invalid comment. */ public function __construct($message, $code, Services_Akismet2_Comment $comment) { parent::__construct($message, $code); $this->_comment = $comment; }
/** * Creates a new HTTP error exception * * @param string $message the error message. * @param integer $code the error code. * @param HTTP_Request2 $request the object used to make the request that * failed. */ public function __construct($message, $code, HTTP_Request2 $request) { parent::__construct($message, $code); $this->_request = $request; }
/** * @param \PEAR_Exception $e * An unhandled exception. * @param array $apiRequest * The full description of the API request. * @return array * API response. */ public function formatPearException($e, $apiRequest) { $data = array(); $error = $e->getCause(); if ($error instanceof \DB_Error) { $data["error_code"] = \DB::errorMessage($error->getCode()); $data["sql"] = $error->getDebugInfo(); } if (!empty($apiRequest['params']['debug'])) { if (method_exists($e, 'getUserInfo')) { $data['debug_info'] = $error->getUserInfo(); } if (method_exists($e, 'getExtraData')) { $data['debug_info'] = $data + $error->getExtraData(); } $data['trace'] = $e->getTraceAsString(); } else { $data['tip'] = "add debug=1 to your API call to have more info about the error"; } return $this->createError($e->getMessage(), $data, $apiRequest); }
/** * Constructor. * * @param string $msg Error message * @param mixed $code Error code or parent exception * @param string $call API call that generated error * @param HTTP_Request2_Response $resp The HTTP response instance * * @see Services_Twitter_Exception::$call * @see Services_Twitter_Exception::$response * @link http://php.net/exceptions */ public function __construct($msg = null, $code = 0, $call = null, $resp = null) { parent::__construct($msg, $code); $this->call = $call; $this->response = $resp; }
/** * Creates a new invalid API key exception * * @param string $message an error message. * @param int $code a user defined error code. * @param string $apiKey the invalid API key. */ public function __construct($message, $code = 0, $apiKey = '') { $this->_apiKey = $apiKey; parent::__construct($message, $code); }
public function __construct($message, $errno) { socket_clear_error(); parent::__construct($message, $errno); }
/** * Redefine the exception so message isn't optional * Supported signatures: * - PEAR_Exception(string $message); * - PEAR_Exception(string $message, int $code); * - PEAR_Exception(string $message, Exception $cause); * - PEAR_Exception(string $message, Exception $cause, int $code); * - PEAR_Exception(string $message, PEAR_Error $cause); * - PEAR_Exception(string $message, PEAR_Error $cause, int $code); * - PEAR_Exception(string $message, array $causes); * - PEAR_Exception(string $message, array $causes, int $code); * * @param string $message exception message * @param int $code * @param Exception $previous */ public function __construct($message = NULL, $code = 0, Exception $previous = NULL) { parent::__construct($message, $code, $previous); }
/** * Constructor, can set package error code and native error code * * @param string $message exception message * @param int $code package error code, one of class constants * @param int $nativeCode error code from underlying PHP extension */ public function __construct($message = null, $code = null, $nativeCode = null) { parent::__construct($message, $code); $this->_nativeCode = $nativeCode; }
/** * Construct * * Allow no message to construct a exception * * @param string $message Exception message * @param int|Exception|PEAR_Error|array|null $p2 Exception cause * @param int|null $p3 Exception code or null * * @return void */ public function __construct($message = '', $p2 = null, $p3 = null) { parent::__construct($message, $p2, $p3); }
public function __construct($message, $p2 = null, $p3 = null, $priority = null) { $this->_priority = $priority; parent::__construct($message, $p2, $p3); }