Exception: TriCoreDB::ServerError

Inherits:
Error
  • Object
show all
Defined in:
lib/tricoredb/errors.rb

Overview

The server processed the request and did not complete it: a RESPONSE whose status is not ok, or an ERROR frame answering a request.

Instance Attribute Summary collapse

Attributes inherited from Error

#code, #leader_hint

Instance Method Summary collapse

Methods inherited from Error

#redirect?

Constructor Details

#initialize(message = nil, code: nil, leader_hint: nil, status: nil, response: nil, frame: false) ⇒ ServerError

Returns a new instance of ServerError.



61
62
63
64
65
66
# File 'lib/tricoredb/errors.rb', line 61

def initialize(message = nil, code: nil, leader_hint: nil, status: nil, response: nil, frame: false)
  super(message, code: code, leader_hint: leader_hint)
  @status = status
  @response = response
  @frame = frame
end

Instance Attribute Details

#response ⇒ Response? (readonly)

Returns the full response, for its diagnostics.

Returns:

  • (Response, nil) —

    the full response, for its diagnostics



59
60
61
# File 'lib/tricoredb/errors.rb', line 59

def response
  @response
end

#status ⇒ String? (readonly)

Returns error or not_implemented for a RESPONSE; nil for an ERROR frame.

Returns:

  • (String, nil) —

    error or not_implemented for a RESPONSE; nil for an ERROR frame



57
58
59
# File 'lib/tricoredb/errors.rb', line 57

def status
  @status
end

Instance Method Details

#frame? ⇒ Boolean

Returns true when the refusal arrived as an ERROR frame rather than a RESPONSE.

Returns:

  • (Boolean) —

    true when the refusal arrived as an ERROR frame rather than a RESPONSE



69
70
71
# File 'lib/tricoredb/errors.rb', line 69

def frame?
  @frame
end