コード例 #1
0
ファイル: ValidationException.php プロジェクト: k1low/routine
 public function __construct($message = null, $code = 422)
 {
     if (empty($message)) {
         $message = __('Validation Error.');
     }
     parent::__construct($message, $code);
 }
コード例 #2
0
 public function __construct($message = null, $code = 302)
 {
     if (empty($message)) {
         $message = __('Exception Error.');
     }
     parent::__construct($message, $code);
 }
コード例 #3
0
ファイル: YasdException.php プロジェクト: k1low/yasd
 public function __construct($message = null, $code = 500)
 {
     if (empty($message)) {
         $message = __('Yasd Error.');
     }
     parent::__construct($message, $code);
 }
コード例 #4
0
ファイル: YacsvException.php プロジェクト: k1low/yacsv
 /**
  * Constructor
  *
  * @param string $message If no message is given 'Not Found Data' will be the message
  * @param string $code Status code, defaults to 404
  */
 public function __construct($message = null, $code = 404)
 {
     if (empty($message)) {
         $message = __d('Yacsv', 'YacsvException');
     }
     parent::__construct($message, $code);
 }
コード例 #5
0
 public function __construct($message = null, $code = 404)
 {
     if (Configure::read('debug')) {
         $code = 500;
     }
     parent::__construct($message, $code);
 }
 /**
  * @param null $message
  * @param int $code
  */
 public function __construct($message = NULL, $code = 500)
 {
     if (!is_string($message)) {
         $renderer = 'The specified asset renderer';
         if (!empty($message['renderer'])) {
             $renderer = 'Asset renderer ' . $message['renderer'];
         }
         $message = "{$renderer} was not found in this helper.";
     }
     parent::__construct($message, $code);
 }
コード例 #7
0
 /**
  * @param null $message
  * @param int $code
  */
 public function __construct($message = NULL, $code = 500)
 {
     if (!is_string($message)) {
         $block = 'The specified asset block';
         if (!empty($message['assetBLock'])) {
             $block = 'Asset block ' . $message['assetBLock'];
         }
         $message = "{$block} does not exist.";
     }
     parent::__construct($message, $code);
 }
コード例 #8
0
 /**
  * Constructor
  *
  * @param array $error list of validation errors
  * @param integer $code code to report to client
  * @return void
  */
 public function __construct($errors, $code = 412)
 {
     $this->_validationErrors = array_filter($errors);
     $flat = Hash::flatten($this->_validationErrors);
     $errorCount = $this->_validationErrorCount = count($flat);
     $this->message = __dn('crud', 'A validation error occurred', '%d validation errors occurred', $errorCount, array($errorCount));
     if ($errorCount === 1) {
         $code = $this->_deriveRuleSpecific($this->_validationErrors, $code);
     }
     parent::__construct($this->message, $code);
 }
 /**
  * @param null $message
  * @param int $code
  */
 public function __construct($message = NULL, $code = 500)
 {
     if (!is_string($message)) {
         $type = 'The asset type being used';
         if (!empty($message['type'])) {
             $type = 'Asset type ' . $message['type'];
         }
         $class = 'this class';
         if (!empty($message['class'])) {
             $class = 'class ' . $message['class'];
         }
         $message = "{$type} is not supported by {$class}.";
     }
     parent::__construct($message, $code);
 }
コード例 #10
0
 /**
  * @param null $message
  * @param int $code
  */
 public function __construct($message = NULL, $code = 500)
 {
     if (!is_string($message)) {
         $method = 'The specified method';
         if (!empty($message['helperMethod'])) {
             $method = 'Method ' . $message['helperMethod'];
         }
         $helper = 'helper';
         if (!empty($message['helper'])) {
             $helper .= ' ' . $message['helper'];
         }
         $message = "{$method} of {$helper} does not exist.";
     }
     parent::__construct($message, $code);
 }
コード例 #11
0
 /**
  * Sobrescreve exceção do Cake para incluir informação
  * do erro que poderá ser logada.
  *
  * @param string  $message Mensagem da Exceção
  * @param integer $code    Código do erro
  * @param string  $error   O erro retornado pelo PagSeguro (possivelmente um XML)
  */
 public function __construct($message, $code = 1, $error = null)
 {
     if (!empty($error)) {
         try {
             $decoded = Xml::toArray(Xml::build($error));
             $error = $this->_parseXmlError($decoded);
         } catch (XmlException $e) {
             // apenas uma string... não faz conversão
         }
         $error .= $this->getTraceAsString();
         $msg = $message . " (Problema relacionado ao PagSeguro)\n" . $error;
         CakeLog::write('error', $msg);
     }
     parent::__construct($message, $code);
 }
コード例 #12
0
 /**
  * @param null $message
  * @param int $code
  */
 public function __construct($message = NULL, $code = 500)
 {
     if (!is_string($message)) {
         $class = 'The specified asset class';
         if (!empty($message['class'])) {
             $class = 'Asset class ' . $message['class'];
         }
         $package = 'Lib/Asset';
         if (!empty($message['plugin'])) {
             $package = $message['plugin'] . ".{$package}";
         }
         $message = "{$class} could not be located in package {$package}";
     }
     parent::__construct($message, $code);
 }
コード例 #13
0
 public function __construct($message, $mailchimpErrorCode = null, $mailchimpErrorName = null)
 {
     $this->mailchimpErrorCode = $mailchimpErrorCode;
     $this->mailchimpErrorName = $mailchimpErrorName;
     parent::__construct($message);
 }
コード例 #14
0
 public function __construct($message, $code = 404, Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
コード例 #15
0
 /**
  * Generic handler for the internal framework errors CakePHP can generate.
  *
  * @param CakeException $error
  * @return void
  */
 protected function _cakeError(CakeException $error)
 {
     $url = $this->controller->request->here();
     $code = $error->getCode() >= 400 && $error->getCode() < 506 ? $error->getCode() : 500;
     $this->controller->response->statusCode($code);
     $this->controller->set(array('code' => $code, 'url' => h($url), 'name' => $error->getMessage(), 'error' => $error));
     try {
         $this->controller->set($error->getAttributes());
         $this->_outputMessage($this->template);
     } catch (MissingViewException $e) {
         $this->_outputMessage('error500');
     } catch (Exception $e) {
         $this->_outputMessageSafe('error500');
     }
 }
コード例 #16
0
 public function __construct($message = 'Unauthorized', $code = 101)
 {
     parent::__construct($message, $code);
 }
コード例 #17
0
 /**
  * Generic handler for the internal framework errors CakePHP can generate.
  *
  * @param CakeException $error
  * @return void
  */
 protected function _cakeError(CakeException $error)
 {
     $url = $this->controller->request->here();
     $code = $error->getCode() >= 400 && $error->getCode() < 506 ? $error->getCode() : 500;
     $this->controller->response->statusCode($code);
     $this->controller->set(array('code' => $code, 'url' => h($url), 'name' => h($error->getMessage()), 'error' => $error, '_serialize' => array('code', 'url', 'name')));
     $this->controller->set($error->getAttributes());
     $this->_outputMessage($this->template);
 }
コード例 #18
0
 public function __construct($message, $data = null, $debugOnly = null)
 {
     $code = 417;
     parent::__construct($message . ': ' . $data, $code);
 }
コード例 #19
0
 public function __construct(array $errorList = array())
 {
     parent::__construct('Incorrect Request', 102);
     $this->errorList = $errorList;
 }
コード例 #20
0
 public function __construct($message = 'Access Denied', $code = 103)
 {
     parent::__construct($message, $code);
 }
コード例 #21
0
 public function __construct($errCode, $upload = null, $code = 500)
 {
     $message = $this->_mapError($errCode, $upload);
     parent::__construct($message, $code);
 }
コード例 #22
0
 public function __construct($message, $code = 500)
 {
     if (is_array($message)) {
         $message += array('enabled' => true);
     }
     parent::__construct($message, $code);
 }
コード例 #23
0
 public function __construct()
 {
     parent::__construct(__d('like', 'Not liked yet'));
 }
コード例 #24
0
 public function __construct()
 {
     parent::__construct(__d('like', 'Already liked'));
 }
コード例 #25
0
 /**
  * Generic handler for the internal framework errors CakePHP can generate.
  *
  * @param CakeExeption $error
  * @return void
  */
 protected function _cakeError(CakeException $error)
 {
     $url = Router::normalize($this->controller->request->here);
     $code = $error->getCode();
     $this->controller->response->statusCode($code);
     $this->controller->set(array('code' => $code, 'url' => h($url), 'name' => $error->getMessage(), 'error' => $error));
     $this->controller->set($error->getAttributes());
     $this->_outputMessage($this->template);
 }
 /**
  * render the CakeException in the general case
  *
  * @param CakeException $error an instance of CakeException
  * @return void
  */
 protected function defaultCakeRender(CakeException $error)
 {
     $url = $this->controller->request->here();
     $code = $error->getCode() >= 400 && $error->getCode() < 506 ? $error->getCode() : 500;
     $this->controller->response->statusCode($code);
     $this->controller->set(array('code' => $code, 'name' => h(get_class($error)), 'message' => h($error->getMessage()), 'url' => h($url), 'error' => $error, '_serialize' => array('code', 'name', 'message', 'url')));
     $this->controller->set($error->getAttributes());
     $template = $code >= 400 && $code < 500 ? 'error400' : 'error500';
     $this->_outputMessage($template);
 }
コード例 #27
0
 public function __construct($message, $code = 501)
 {
     parent::__construct($message, $code);
 }
コード例 #28
0
 /**
  * Constructs a new instance of the base BaseJsonApiException
  *
  * @param string $title The title of the exception, passed to parent CakeException::__construct
  * @param string $detail A human-readable explanation specific to this occurrence of the problem.
  * @param int $status The http status code of the error, passed to parent CakeException::__construct
  * @param string $id A unique identifier for this particular occurrence of the problem.
  * @param string $href A URI that MAY yield further details about this particular occurrence of the problem.
  * @param array $links An array of JSON Pointers [RFC6901] to the associated resource(s) within the request document [e.g. ["/data"] for a primary data object].
  * @param array $paths An array of JSON Pointers to the relevant attribute(s) within the associated resource(s) in the request document. Each path MUST be relative to the resource path(s) expressed in the error object's "links" member [e.g. ["/first-name", "/last-name"] to reference a couple attributes].
  */
 public function __construct($title = 'Base Serializer Exception', $detail = 'Base Serializer Exception', $status = 400, $id = null, $href = null, $links = array(), $paths = array())
 {
     // Set the passed in properties to the properties of the Object
     $this->title = $title;
     $this->detail = $detail;
     $this->status = $status;
     $this->code = $status;
     $this->id = $id;
     $this->href = $href;
     $this->links = $links;
     $this->paths = $paths;
     // construct the parent CakeException class
     parent::__construct($this->title, $this->status);
 }