public function __construct($title, $code, array $errorList, $previous) { if ($previous instanceof \PDOException) { //gets additional information about the database error $details = ['state' => $previous->errorInfo[0], 'code' => $previous->errorInfo[1], 'msg' => $previous->errorInfo[2]]; //retrieves useful information from the error message switch ($details['state']) { case self::STATE_INTEGRITY_CONSTRAINT_VIOLATION: switch ($details['code']) { case self::CODE_DUPLICATE_UNIQUE_KEY: if (preg_match('|entry \'([\\w\\d-]*)\' for key \'([\\w\\d_]*)\'|', $details['msg'], $pieces)) { $details['entry'] = explode('-', $pieces[1]); $details['key'] = $pieces[2]; } break; } break; } if (isset($errorList['dev'])) { $errorList['dev'] = array_merge($details, ['more' => $errorList['dev']]); } else { $errorList['dev'] = $details; } $this->details = $details; } parent::__construct($title, $code, $errorList, $previous); }
/** * Constructor * * @param string $url The not found URL * @param array $details The exception details */ public function __construct($url = '', $details = array()) { if (!$url) { $url = App::request()->getFullUrl(); } $details['url'] = $url; $message = Lang::get('main.http-error-404-message', $details); parent::__construct($message, $details); }
/** * Constructor * * @param string $path The called path * @param string $method The bad method */ public function __construct($path, $method) { $details = array('path' => $path, 'method' => $method); $message = Lang::get('main.http-error-' . self::STATUS_CODE . '-message', $details); parent::__construct($message, $details); }
public function __construct($message = 'Unexpected Content-Type header.') { parent::__construct("Unsupported Media Type", 415, $message); }
function __construct($message, $code = null, $previous = null) { parent::__construct(new APIResponse([status_code => 501, body => $message]), $code, $previous); }
public function __construct($message = 'The client took too long to respond.') { parent::__construct("Request Timeout", 408, $message); }
public function __construct($message, $error_code) { parent::__construct(500, $message, $error_code); }
public function __construct($message = 'Internal server error for unknown reasons.') { parent::__construct("Internal Server Error", 500, $message); }
public function __construct($url) { $msg = 'The URL ' . htmlize($url) . ' caused too many redirections.'; parent::__construct($msg); }
public function __construct($message = 'Unexpected route, invalid value or missing parameter in the request.') { parent::__construct("Bad Request", 400, $message); }
public function __construct($message = 'Insufficient storage.') { parent::__construct("Insufficient Storage", 507, $message); }
public function __construct($message = 'Unauthorized resource or insufficient permission level.') { parent::__construct("Unauthorized", 401, $message); }
public function __construct($message = 'Server route request method is not supported.') { parent::__construct("Not Implemented", 501, $message); }
public function __construct($message = 'Access to this resource is permanently forbidden regardless of auth status.') { parent::__construct("Forbidden", 403, $message); }
public function __construct($extramsg = '') { $x = $_SERVER['REQUEST_URI']; $x = preg_replace('/[<>]/', '', $x); $x = preg_replace('/\\?.*/', '', $x); $msg = "{$x} not found"; if ($extramsg) { $msg .= " ({$extramsg})"; } parent::__construct($msg, 404); }
public function __construct($message = 'The used method (HTTP verb) is not allowed for this resource.') { parent::__construct("Method Not Allowed", 405, $message); }
public function __construct($path, $method) { $this->_path = $path; $this->_method = $method; parent::__construct($path, $method, "404"); }
public function __construct($message = NULL) { parent::__construct($message, 404); }
public function __construct($message = 'Resource not found.') { parent::__construct("Not Found", 404, $message); }
public function __construct($message = 'Bandwidth limit exceeded.') { parent::__construct("Bandwidth Limit Exceeded", 509, $message); }
public function __construct($message = 'Client sent too many requests.') { parent::__construct("Too Many Requests", 429, $message); }
/** * Constructor * * @param string $message Error message * @param int $code Error code */ public function __construct($message, $code) { parent::__construct($message, $code); $this->message = $message; $this->code = $code; }
public function __construct($message = 'Resource conflict. Could be server side or client side.') { parent::__construct("Conflict", 409, $message); }
/** * @param int $code * @param string $message */ public function __construct($code, $message) { $this->jsonArray = ['error' => ['message' => $message, 'type' => stripNamespaces(get_called_class()), 'code' => (int) $code]]; parent::__construct($message, $code); }
public function __construct($message = 'Service unavailable. Might be due to traffic load.') { parent::__construct("Service Unavailable", 503, $message); }
public function __construct($code, $message, $error_code = null) { parent::__construct($code, $message, $error_code); }
public function __construct($message) { parent::__construct(404, $message, null); }
public function __construct($message = 'Resource is permanently gone.') { parent::__construct("Gone", 410, $message); }
public function __construct($message = "I’m a teapot", $code = 418, Exception $previous = null) { parent::__construct($message, $code, $previous); }
public function __construct($message = 'This resource has been permanently moved.') { parent::__construct("Moved Permanently", 301, $message); }