处理未知状态代码[CakeException]未知状态代码

时间:2014-02-01 17:38:25

标签: php cakephp cakephp-2.0

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

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]内部服务器错误

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

1 个答案:

答案 0 :(得分:0)

导致[CakeException] Unknown status code,因为CakePHP无法识别错误代码110.请查看:

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

这是一种将自定义HTTP代码添加到蛋糕批准列表的方法。我在AppController中使用它。

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