doufen9815 2018-08-22 21:10
浏览 69
已采纳

如何在Stripe Php中捕获异常?

I need to catch the exception, but try catch does not catch anything.

try {
    return \Stripe\Transfer::create($array);
} catch (Exception $e) {
    var_dump($e);
}

I get the error:

In ApiRequestor.php line 181: You have insufficient funds in your Stripe account.....

Line 181 shows me the last method call with:

return new Error\InvalidRequest($msg, $param, $rcode, $rbody, $resp, $rheaders);
  • 写回答

1条回答 默认 最新

  • doushang1964 2018-08-22 21:23
    关注

    You forgot the backslash

    try {
        return \Stripe\Transfer::create($array);
    } catch (\Exception $e) { // <--- HERE
        var_dump($e);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?