Google\Cloud\GrpcRequestWrapper::convertToGoogleException PHP Метод

convertToGoogleException() приватный Метод

Convert a GAX exception to a Google Exception.
private convertToGoogleException ( Google\GAX\ApiException $ex ) : ServiceException
$ex Google\GAX\ApiException
Результат ServiceException
    private function convertToGoogleException(ApiException $ex)
    {
        switch ($ex->getCode()) {
            case Grpc\STATUS_INVALID_ARGUMENT:
                $exception = Exception\BadRequestException::class;
                break;
            case Grpc\STATUS_NOT_FOUND:
                $exception = Exception\NotFoundException::class;
                break;
            case Grpc\STATUS_ALREADY_EXISTS:
                $exception = Exception\ConflictException::class;
                break;
            case Grpc\STATUS_UNKNOWN:
                $exception = Exception\ServerException::class;
                break;
            case Grpc\STATUS_INTERNAL:
                $exception = Exception\ServerException::class;
                break;
            default:
                $exception = Exception\ServiceException::class;
                break;
        }
        return new $exception($ex->getMessage(), $ex->getCode(), $ex);
    }