如何修复 Facebook 致命错误:未捕获的 CurlException 问题 [英] how to fix a facebook Fatal error: Uncaught CurlException problem

查看:29
本文介绍了如何修复 Facebook 致命错误:未捕获的 CurlException 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不时从​​ facebook 收到此错误:

I've got this error coming from facebook, from time to time:

致命错误:未捕获的 CurlException:28:connect() 超时!在第 614 行的/var/www/html/xxx/facebook/src/facebook.php 中抛出

它破坏了我的网站.

这是来自 facebook.php 的代码

this is the code from facebook.php

if ($result === false) {
  $e = new FacebookApiException(array(
    'error_code' => curl_errno($ch),
    'error'      => array(
      'message' => curl_error($ch),
      'type'    => 'CurlException',
    ),
  ));
  curl_close($ch);
  throw $e;
}

有没有办法解决这个问题?或至少优雅地降级?谢谢

is there a way to fix this? or at lease to degrade gracefully ? thanks

我正在考虑 arr a return false; 如果 $result === true但不知道能不能解决

i am thinking to arr a return false; if the $result === true but i don't know if that will fix it

推荐答案

捕获异常以避免立即致命错误杀死,但您仍然需要适应 facebook 数据不可用.请参阅 http://www.php.net/catch

Catch the exception to avoid the immediate Fatal Error kill, but you still need to adjust to facebook data not being available. See http://www.php.net/catch

try {
    // facebook code
} catch (Exception $e) {
    // maybe something more graceful...
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}
// regular execution continues.

这篇关于如何修复 Facebook 致命错误:未捕获的 CurlException 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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