• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CakeException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CakeException的典型用法代码示例。如果您正苦于以下问题:PHP CakeException类的具体用法?PHP CakeException怎么用?PHP CakeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CakeException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _cakeError

 /**
  * 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');
     }
 }
开发者ID:Chromedian,项目名称:inventory,代码行数:21,代码来源:ExceptionRenderer.php


示例2: _cakeError

 /**
  * 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);
 }
开发者ID:alvaroziqar,项目名称:galei,代码行数:15,代码来源:ExceptionRenderer.php


示例3: _cakeError

 /**
  * 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);
 }
开发者ID:no2key,项目名称:Web-Framework-Benchmark,代码行数:15,代码来源:exception_renderer.php


示例4: defaultCakeRender

 /**
  * 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);
 }
开发者ID:loadsys,项目名称:cakephp-serializers-errors,代码行数:16,代码来源:SerializerExceptionRenderer.php


示例5: __construct

 /**
  * 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);
 }
开发者ID:loadsys,项目名称:cakephp-serializers-errors,代码行数:25,代码来源:BaseSerializerException.php


示例6: __construct

 public function __construct($message = null, $code = 422)
 {
     if (empty($message)) {
         $message = __('Validation Error.');
     }
     parent::__construct($message, $code);
 }
开发者ID:k1low,项目名称:routine,代码行数:7,代码来源:ValidationException.php


示例7: __construct

 public function __construct($message = null, $code = 302)
 {
     if (empty($message)) {
         $message = __('Exception Error.');
     }
     parent::__construct($message, $code);
 }
开发者ID:k1low,项目名称:ya,代码行数:7,代码来源:InactiveControllerException.php


示例8: __construct

 public function __construct($message = null, $code = 500)
 {
     if (empty($message)) {
         $message = __('Yasd Error.');
     }
     parent::__construct($message, $code);
 }
开发者ID:k1low,项目名称:yasd,代码行数:7,代码来源:YasdException.php


示例9: __construct

 /**
  * 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);
 }
开发者ID:k1low,项目名称:yacsv,代码行数:13,代码来源:YacsvException.php


示例10: __construct

 public function __construct($message = null, $code = 404)
 {
     if (Configure::read('debug')) {
         $code = 500;
     }
     parent::__construct($message, $code);
 }
开发者ID:gourmet,项目名称:common,代码行数:7,代码来源:CommonBadConfigurationException.php


示例11: __construct

 /**
  * @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);
 }
开发者ID:netors,项目名称:CakePHP-AutoAsset-Plugin,代码行数:15,代码来源:AssetRendererNotFoundException.php


示例12: __construct

 /**
  * @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);
 }
开发者ID:netors,项目名称:CakePHP-AutoAsset-Plugin,代码行数:15,代码来源:AssetBlockNotFoundException.php


示例13: __construct

 /**
  * 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);
 }
开发者ID:linking-arts,项目名称:furry-goggles,代码行数:18,代码来源:CrudValidationException.php


示例14: __construct

 /**
  * @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);
 }
开发者ID:netors,项目名称:CakePHP-AutoAsset-Plugin,代码行数:19,代码来源:AssetTypeUnsupportedException.php


示例15: __construct

 /**
  * @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);
 }
开发者ID:netors,项目名称:CakePHP-AutoAsset-Plugin,代码行数:19,代码来源:HelperMethodNotFoundException.php


示例16: __construct

 /**
  * 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);
 }
开发者ID:radig,项目名称:pagseguro,代码行数:23,代码来源:PagSeguroException.php


示例17: __construct

 /**
  * @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);
 }
开发者ID:netors,项目名称:CakePHP-AutoAsset-Plugin,代码行数:19,代码来源:MissingAssetClassException.php


示例18: __construct

 public function __construct($message, $mailchimpErrorCode = null, $mailchimpErrorName = null)
 {
     $this->mailchimpErrorCode = $mailchimpErrorCode;
     $this->mailchimpErrorName = $mailchimpErrorName;
     parent::__construct($message);
 }
开发者ID:drmonkeyninja,项目名称:cakephp-mailchimp,代码行数:6,代码来源:MailchimpAppModel.php


示例19: __construct

 public function __construct($message, $code = 404, Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
开发者ID:ronaldsalazar23,项目名称:ComercialChiriguano,代码行数:4,代码来源:exceptions.php


示例20: __construct

 public function __construct($message = 'Unauthorized', $code = 101)
 {
     parent::__construct($message, $code);
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:4,代码来源:ApiUnauthorizedException.php



注:本文中的CakeException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CakeLog类代码示例发布时间:2022-05-20
下一篇:
PHP CakeEventManager类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap