使用Facebook REST API PHP客户端库,似乎明智地将调用包装在try{}
中:
require('facebook.php');
$fb = new Facebook($fbApiKey, $fbSecret);
try {
$result = $fb->api_client->some_api_method(...);
} catch (FacebookRestClientException $e) {
// now what?
}
但我不知道如何处理异常,例如找出问题所在或向错误日志写一个合理的消息。某处有这些例外的文档吗?
答案 0 :(得分:0)
在检查代码和一些示例异常之后,我认为$e
是一个看起来像这样的对象:
(
[message:protected] => An error message string
[string:Exception:private] => Don't know
[code:protected] => A numerical error code
[file:protected] => File here the exception was thrown
[line:protected] => Line where the exception was thrown
[trace:Exception:private] => A PHP debug_backtrace() result
[previous:Exception:private] => Don't know
)