Exception: Arango::ErrorDB

Inherits:
Error
  • Object
show all
Defined in:
lib/arango/error_db.rb

Overview

Arango ErrorDB

Constant Summary

Constants inherited from Error

Arango::Error::ARANGODB_ERRORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, code:, data:, error_num:, action: nil, url: nil, request:) ⇒ ErrorDB

Create database error representation



9
10
11
12
13
14
15
16
17
# File 'lib/arango/error_db.rb', line 9

def initialize(message:, code:, data:, error_num:, action: nil, url: nil, request:)
  @message   = message
  @code      = code
  @data      = data
  @error_num = error_num
  @action    = action
  @url       = url
  @request   = request
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def action
  @action
end

#codeObject (readonly)

Returns the value of attribute code.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def data
  @data
end

#error_numObject (readonly)

Returns the value of attribute error_num.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def error_num
  @error_num
end

#messageObject (readonly)

Returns the value of attribute message.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def message
  @message
end

#requestObject (readonly)

Returns the value of attribute request.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def request
  @request
end

#urlObject (readonly)

Returns the value of attribute url.



18
19
20
# File 'lib/arango/error_db.rb', line 18

def url
  @url
end

Instance Method Details

#to_hHash

convert to hash

Returns:

  • (Hash)


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/arango/error_db.rb', line 23

def to_h
  {
    action: @action,
    url: @url,
    request: @request,
    message: @message,
    code: @code,
    data: @data,
    errorNum: @error_num
  }.delete_if{|_,v| v.nil?}
end