Class: Tarantool::Client::BoxError

Inherits:
Data
  • Object
show all
Defined in:
tarantool-client/lib/tarantool/client/box_error.rb

Overview

A box.error object returned as data (MP_ERROR extension), with its cause chain.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#cause ⇒ Object (readonly)

Returns the value of attribute cause

Returns:

  • (Object) —

    the current value of cause



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def cause
  @cause
end

#code ⇒ Object (readonly)

Returns the value of attribute code

Returns:

  • (Object) —

    the current value of code



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def code
  @code
end

#errno ⇒ Object (readonly)

Returns the value of attribute errno

Returns:

  • (Object) —

    the current value of errno



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def errno
  @errno
end

#fields ⇒ Object (readonly)

Returns the value of attribute fields

Returns:

  • (Object) —

    the current value of fields



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def fields
  @fields
end

#file ⇒ Object (readonly)

Returns the value of attribute file

Returns:

  • (Object) —

    the current value of file



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def file
  @file
end

#line ⇒ Object (readonly)

Returns the value of attribute line

Returns:

  • (Object) —

    the current value of line



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def line
  @line
end

#message ⇒ Object (readonly)

Returns the value of attribute message

Returns:

  • (Object) —

    the current value of message



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def message
  @message
end

#type ⇒ Object (readonly)

Returns the value of attribute type

Returns:

  • (Object) —

    the current value of type



6
7
8
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 6

def type
  @type
end

Class Method Details

.from_stack(entries) ⇒ Object



7
8
9
10
11
12
# File 'tarantool-client/lib/tarantool/client/box_error.rb', line 7

def self.from_stack(entries)
  entries.reverse_each.reduce(nil) do |cause, entry|
    attributes = entry.transform_keys(Protocol::Constants::ERROR_FIELDS)
    new(**Protocol::Constants::ERROR_FIELDS.values.to_h { |field| [field, attributes[field]] }, cause:)
  end
end