Exception: Riak::ProtobuffsFailedRequest
- Inherits:
-
FailedRequest
- Object
- StandardError
- FailedRequest
- Riak::ProtobuffsFailedRequest
- Defined in:
- lib/riak/failed_request.rb
Overview
Exception raised when receiving an unexpected Protocol Buffers response from Riak
Instance Method Summary (collapse)
-
- (ProtobuffsFailedRequest) initialize(code, message)
constructor
A new instance of ProtobuffsFailedRequest.
-
- (true, false) is_json?
Whether the error response is in JSON.
-
- (true, false) not_found?
Whether the error represents a “not found” response.
-
- (true, false) server_error?
Whether the error represents an internal server error.
Methods included from Util::Translation
Constructor Details
- (ProtobuffsFailedRequest) initialize(code, message)
A new instance of ProtobuffsFailedRequest
53 54 55 56 57 58 |
# File 'lib/riak/failed_request.rb', line 53 def initialize(code, ) super t('protobuffs_failed_request', :code => code, :body => ) @original_message = @not_found = code == :not_found @server_error = code == :server_error end |
Instance Method Details
- (true, false) is_json?
Whether the error response is in JSON
61 62 63 64 65 66 67 68 |
# File 'lib/riak/failed_request.rb', line 61 def is_json? begin JSON.parse() true rescue false end end |
- (true, false) not_found?
Whether the error represents a "not found" response
71 72 73 |
# File 'lib/riak/failed_request.rb', line 71 def not_found? @not_found end |
- (true, false) server_error?
Whether the error represents an internal server error
77 78 79 |
# File 'lib/riak/failed_request.rb', line 77 def server_error? @server_error end |