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

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

Convert any exception to a Google Exception.
private convertToGoogleException ( Exception $ex ) : ServiceException
$ex Exception
Результат ServiceException
    private function convertToGoogleException(\Exception $ex)
    {
        switch ($ex->getCode()) {
            case 400:
                $exception = Exception\BadRequestException::class;
                break;
            case 404:
                $exception = Exception\NotFoundException::class;
                break;
            case 409:
                $exception = Exception\ConflictException::class;
                break;
            case 500:
                $exception = Exception\ServerException::class;
                break;
            default:
                $exception = Exception\ServiceException::class;
                break;
        }
        return new $exception($this->getExceptionMessage($ex), $ex->getCode(), $ex);
    }