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);
 }
示例#2
0
 /**
  * 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);
 }
示例#3
0
 /**
  * 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);
 }
示例#4
0
 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);
 }
示例#6
0
 public function __construct($message = 'The client took too long to respond.')
 {
     parent::__construct("Request Timeout", 408, $message);
 }
示例#7
0
 public function __construct($message, $error_code)
 {
     parent::__construct(500, $message, $error_code);
 }
示例#8
0
 public function __construct($message = 'Internal server error for unknown reasons.')
 {
     parent::__construct("Internal Server Error", 500, $message);
 }
示例#9
0
 public function __construct($url)
 {
     $msg = 'The URL ' . htmlize($url) . ' caused too many redirections.';
     parent::__construct($msg);
 }
示例#10
0
 public function __construct($message = 'Unexpected route, invalid value or missing parameter in the request.')
 {
     parent::__construct("Bad Request", 400, $message);
 }
示例#11
0
 public function __construct($message = 'Insufficient storage.')
 {
     parent::__construct("Insufficient Storage", 507, $message);
 }
示例#12
0
 public function __construct($message = 'Unauthorized resource or insufficient permission level.')
 {
     parent::__construct("Unauthorized", 401, $message);
 }
示例#13
0
 public function __construct($message = 'Server route request method is not supported.')
 {
     parent::__construct("Not Implemented", 501, $message);
 }
示例#14
0
 public function __construct($message = 'Access to this resource is permanently forbidden regardless of auth status.')
 {
     parent::__construct("Forbidden", 403, $message);
 }
示例#15
0
 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);
 }
示例#16
0
 public function __construct($message = 'The used method (HTTP verb) is not allowed for this resource.')
 {
     parent::__construct("Method Not Allowed", 405, $message);
 }
示例#17
0
 public function __construct($path, $method)
 {
     $this->_path = $path;
     $this->_method = $method;
     parent::__construct($path, $method, "404");
 }
示例#18
0
 public function __construct($message = NULL)
 {
     parent::__construct($message, 404);
 }
示例#19
0
 public function __construct($message = 'Resource not found.')
 {
     parent::__construct("Not Found", 404, $message);
 }
示例#20
0
 public function __construct($message = 'Bandwidth limit exceeded.')
 {
     parent::__construct("Bandwidth Limit Exceeded", 509, $message);
 }
示例#21
0
 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;
 }
示例#23
0
 public function __construct($message = 'Resource conflict. Could be server side or client side.')
 {
     parent::__construct("Conflict", 409, $message);
 }
示例#24
0
 /**
  * @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);
 }
示例#25
0
 public function __construct($message = 'Service unavailable. Might be due to traffic load.')
 {
     parent::__construct("Service Unavailable", 503, $message);
 }
示例#26
0
 public function __construct($code, $message, $error_code = null)
 {
     parent::__construct($code, $message, $error_code);
 }
示例#27
0
 public function __construct($message)
 {
     parent::__construct(404, $message, null);
 }
示例#28
0
 public function __construct($message = 'Resource is permanently gone.')
 {
     parent::__construct("Gone", 410, $message);
 }
示例#29
0
 public function __construct($message = "I’m a teapot", $code = 418, Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
示例#30
0
 public function __construct($message = 'This resource has been permanently moved.')
 {
     parent::__construct("Moved Permanently", 301, $message);
 }