Exception: Tarantool::ServerError

Inherits:
Error
  • Object
show all
Defined in:
tarantool-client/lib/tarantool/client/errors.rb

Overview

Error returned by the server for a request.

Instance Attribute Summary collapse

Attributes inherited from Error

#deleted

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code:, error_stack: [], schema_version: nil) ⇒ ServerError

Returns a new instance of ServerError.



56
57
58
59
60
61
# File 'tarantool-client/lib/tarantool/client/errors.rb', line 56

def initialize(message, code:, error_stack: [], schema_version: nil)
  super(message)
  @code = code
  @error_stack = error_stack
  @schema_version = schema_version
end

Instance Attribute Details

#code ⇒ Object (readonly)

Returns the value of attribute code.



47
48
49
# File 'tarantool-client/lib/tarantool/client/errors.rb', line 47

def code
  @code
end

#error_stack ⇒ Object (readonly)

Returns the value of attribute error_stack.



47
48
49
# File 'tarantool-client/lib/tarantool/client/errors.rb', line 47

def error_stack
  @error_stack
end

#schema_version ⇒ Object (readonly)

Returns the value of attribute schema_version.



47
48
49
# File 'tarantool-client/lib/tarantool/client/errors.rb', line 47

def schema_version
  @schema_version
end

Class Method Details

.from_response(response) ⇒ Object



49
50
51
52
53
54
# File 'tarantool-client/lib/tarantool/client/errors.rb', line 49

def self.from_response(response)
  new(
    response.error_message,
    code: response.error_code, error_stack: response.error_stack, schema_version: response.schema_version
  )
end