Class: Momento::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/momento/response/response.rb,
lib/momento/response/error.rb

Overview

The response from a Momento service request.

CacheClient returns a response for both success and error, as well as other states. See the documenation for each type of response for more.

You can always check for an error response with ‘response.error?` and get the error itself with `response.error`.

‘response.error` is an Exception and can be raised. It contains additional information about the error, see Error for more information.

See Also:

Instance Method Summary collapse

Instance Method Details

#errorMomento::Error?

Returns the error portion of the response, if any.

Returns:



40
41
42
# File 'lib/momento/response/response.rb', line 40

def error
  nil
end

#error?Boolean

Is the response an error?

Returns:

  • (Boolean)


47
48
49
# File 'lib/momento/response/response.rb', line 47

def error?
  false
end

#to_sString

Displays the type of response and additional info, if any.

Returns:

  • (String)


53
54
55
# File 'lib/momento/response/response.rb', line 53

def to_s
  self.class.to_s
end