Core/src/RequestWrapper.php
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 412:
                $exception = Exception\FailedPreconditionException::class;
                break;

            case 500:
                $exception = Exception\ServerException::class;
                break;

            case 504:
                $exception = Exception\DeadlineExceededException::class;
                break;

            default:
                $exception = Exception\ServiceException::class;
                break;
        }

        return new $exception($this->getExceptionMessage($ex), $ex->getCode(), $ex);
    }
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 412:
                $exception = Exception\FailedPreconditionException::class;
                break;

            case 500:
                $exception = Exception\ServerException::class;
                break;

            case 504:
                $exception = Exception\DeadlineExceededException::class;
                break;

            default:
                $exception = Exception\ServiceException::class;
                break;
        }

        return new $exception($this->getExceptionMessage($ex), $ex->getCode(), $ex);
    }
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 412 : $ exception = Exception \ FailedPreconditionException :: class ; break ; case 500 : $ exception = Exception \ ServerException :: class ; break ; case 504 : $ exception = Exception \ DeadlineExceededException :: class ; break ; default : $ exception = Exception \ ServiceException :: class ; break ; } return new $ exception ( $ this -> getExceptionMessage ( $ ex ) , $ ex -> getCode ( ) , $ ex ) ; }
Convert any exception to a Google Exception.

@param \Exception $ex
@return Exception\ServiceException
Convert any exception to a Google Exception .