Google\Cloud\RequestWrapper::getExceptionMessage PHP Method

getExceptionMessage() private method

Gets the exception message.
private getExceptionMessage ( Exception $ex ) : string
$ex Exception
return string
    private function getExceptionMessage(\Exception $ex)
    {
        if ($ex instanceof RequestException && $ex->hasResponse()) {
            $res = (string) $ex->getResponse()->getBody();
            json_decode($res);
            if (json_last_error() === JSON_ERROR_NONE) {
                return $res;
            }
        }
        return $ex->getMessage();
    }