Php Google API错误处理无法获取错误消息

Php Google API错误处理无法获取错误消息,php,google-api,google-calendar-api,Php,Google Api,Google Calendar Api,Google calendar API为无效的事件ID返回错误,我使用try catch进行错误处理,但错误响应以对象形式出现,如下所示 Google_Service_Exception Object ( [errors:protected] => Array ( [0] => Array ( [domain] => global

Google calendar API为无效的事件ID返回错误,我使用try catch进行错误处理,但错误响应以对象形式出现,如下所示

Google_Service_Exception Object
(
    [errors:protected] => Array
        (
            [0] => Array
                (
                    [domain] => global
                    [reason] => deleted
                    [message] => Resource has been deleted
                )

        )

    [retryMap:Google_Service_Exception:private] => Array
        (
            [500] => -1
            [503] => -1
            [rateLimitExceeded] => -1
            [userRateLimitExceeded] => -1
        )

    [message:protected] => Error calling DELETE https://www.googleapis.com/calendar/v3/calendars/primary/events/qdkeiablias0t17vn3kh5aopq0_20160614T000000Z: (410) Resource has been deleted
    [string:Exception:private] => 
    [code:protected] => 410
    [file:protected] => C:\xampp\htdocs\sys-feedback\application\vendor\google\apiclient\src\Google\Http\REST.php
    [line:protected] => 110
    [trace:Exception:private] => Array
        (
如何使用php获取
消息

我也使用了JSON解码,但它不返回任何内容

foreach ($event_ids as $eventID):
        try {
            $this->service->events->delete('primary', $eventID);
        } catch (Google_Service_Exception $e) {


        }


    endforeach;
    $result = json_decode($e,true);
    print_r($result;

当我做
echo$e['errors'][0]['message']时
它返回
不能将类型为Google\u Service\u Exception的对象用作

中的数组作为您可以执行的bug标题
$e->getMessage()

如前所述,关于
$e->getErrors()
,我还不确定,仍然需要尝试一下

try {
    $this->service->events->delete('primary', $eventID);
} catch (Google_Service_Exception $e) {
    $e->getMessage();           // This works
    print_r($e->getErrors());   // Not sure yet, have to test
}