Sha256: 5a3b38f1291825580253f0fc8c2485a9e177239b2ccb3615302634f3b2d1ac4b

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

require 'grpc'
require_relative 'cacheclient_pb'

module Momento
  # @private
  class DeleteResponseBuilder < ResponseBuilder
    # Build a Momento::DeleteResponse from a block of code
    # which returns a Momento::CacheClient::DeleteResponse..
    #
    # @return [Momento::DeleteResponse]
    # @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
      DeleteResponse::Error.new(exception: e, context: context)
    else
      raise TypeError unless response.is_a?(::Momento::CacheClient::DeleteResponse)

      DeleteResponse::Success.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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