Exception: Riak::ProtobuffsFailedRequest
- Inherits:
-
FailedRequest
- Object
- StandardError
- FailedRequest
- Riak::ProtobuffsFailedRequest
- Defined in:
- riak-client/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
66 67 68 69 70 71 |
# File 'riak-client/lib/riak/failed_request.rb', line 66 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
74 75 76 77 78 79 80 81 |
# File 'riak-client/lib/riak/failed_request.rb', line 74 def is_json? begin JSON.parse() true rescue false end end |
- (true, false) not_found?
Whether the error represents a “not found” response
84 85 86 |
# File 'riak-client/lib/riak/failed_request.rb', line 84 def not_found? @not_found end |
- (true, false) server_error?
Whether the error represents an internal server error
90 91 92 |
# File 'riak-client/lib/riak/failed_request.rb', line 90 def server_error? @server_error end |