处理未知状态代码[CakeException]未知状态代码 [英] handling unknown status codes [CakeException] Unknown status code

查看:209
本文介绍了处理未知状态代码[CakeException]未知状态代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何处理另一个http服务器的优雅的故障我通过HttpSocket谈话?未能找到任何好的示例

How would I handle gracefully failures of another http server i'm talking to via HttpSocket? Haven't been able to find any good examples

Stack Trace:
2014-02-01 07:00:35 Error: Fatal Error (256): [CakeException] Unknown status code
#0 /home/alterscape/lab/cakephp/lib/Cake/Error/ExceptionRenderer.php(212): CakeResponse-    >statusCode(110)
#1 [internal function]: ExceptionRenderer->error400(Object(SocketException))
#2 /home/alterscape/lab/cakephp/lib/Cake/Error/ExceptionRenderer.php(175): call_user_func_array(Array, Array)
#3 /home/alterscape/lab/cakephp/lib/Cake/Error/ErrorHandler.php(120): ExceptionRenderer->render()
#4 [internal function]: ErrorHandler::handleException(Object(SocketException))
#5 {main} in [/home/alterscape/lab/cakephp/lib/Cake/Error/ErrorHandler.php, line 129]

2014-02-01 07:00:35错误:[InternalErrorException]内部伺服器错误

2014-02-01 07:00:35 Error: [InternalErrorException] Internal Server Error

StackTrace
#0 /home/alterscape/lab/cakephp/lib/Cake/Routing/Dispatcher.php(185): Controller->invokeAction(Object(CakeRequest))
#1 /home/alterscape/lab/cakephp/lib/Cake/Routing/Dispatcher.php(160): Dispatcher->_invoke(Object(SecurityLogsController), Object(CakeRequest), Object(CakeResponse))
#2 /home/alterscape/lab/cakephp/app/webroot/index.php(108): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#3 {main}
2014-02-01 07:00:35 Error: [SocketException] Connection timed out


推荐答案

[CakeException]未知状态代码是因为CakePHP无法识别错误代码110。签出:

The [CakeException] Unknown status code is caused because CakePHP doesn't recognize Error Code 110. Check out:

http://api.cakephp.org/2.3/source-class-CakeResponse.html#601-617

以下是添加您的自定义HTTP代码到蛋糕的批准列表。我在AppController中使用它。

Here's a way to add your custom HTTP code to cake's approved list. I use this in AppController.

http://api.cakephp.org/2.3/class-CakeResponse.html#_httpCodes

这篇关于处理未知状态代码[CakeException]未知状态代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆