class Riak::ProtobuffsFailedRequest
Exception raised when receiving an unexpected Protocol Buffers response from Riak
Attributes
code[R]
original_message[R]
Public Class Methods
new(code, message)
click to toggle source
Calls superclass method
Riak::FailedRequest::new
# File lib/riak/errors/failed_request.rb, line 13 def initialize(code, message) super t('protobuffs_failed_request', :code => code, :body => message) @original_message = message @code = code @not_found = code == :not_found @server_error = code == :server_error end
Public Instance Methods
body()
click to toggle source
# File lib/riak/errors/failed_request.rb, line 42 def body @original_message end
is_json?()
click to toggle source
@return [true, false] whether the error response is in JSON
# File lib/riak/errors/failed_request.rb, line 22 def is_json? begin JSON.parse(@original_message) true rescue false end end
not_found?()
click to toggle source
@return [true,false] whether the error represents a “not found” response
# File lib/riak/errors/failed_request.rb, line 32 def not_found? @not_found end
server_error?()
click to toggle source
@return [true,false] whether the error represents an internal
server error
# File lib/riak/errors/failed_request.rb, line 38 def server_error? @server_error end