Sha256: 8ceffbd89a14569f3e6eb6a04fd428424be156b16836d172042eab1c1eaf58a0

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

require 'grpc'
require_relative 'controlclient_pb'

module Momento
  # @private
  class DeleteCacheResponseBuilder < ResponseBuilder
    # Build a Momento::DeleteCacheResponse from a block of code
    # which returns a Momento::ControlClient::DeleteCacheResponse..
    #
    # @return [Momento::DeleteCacheResponse]
    # @raise [StandardError] when the exception is not recognized.
    # @raise [TypeError] when the response is not recognized.
    def from_block
      response = yield
    rescue *RESCUED_EXCEPTIONS => e
      DeleteCacheResponse::Error.new(
        exception: e, context: context
      )
    else
      raise TypeError unless response.is_a?(::Momento::ControlClient::DeleteCacheResponse)

      return DeleteCacheResponse::Success.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
momento-0.2.0 lib/momento/delete_cache_response_builder.rb