Class: Glia::Errors::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/glia/errors/error.rb

Overview

Base error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, ref:, message: nil, error_details: nil) ⇒ Error

Returns a new instance of Error.



11
12
13
14
15
16
# File 'lib/glia/errors/error.rb', line 11

def initialize(type:, ref:, message: nil, error_details: nil)
  @type = type
  @ref = ref
  @message = message
  @error_details = error_details
end

Instance Attribute Details

#error_detailsObject (readonly)

Returns the value of attribute error_details.



9
10
11
# File 'lib/glia/errors/error.rb', line 9

def error_details
  @error_details
end

#messageObject (readonly)

Returns the value of attribute message.



9
10
11
# File 'lib/glia/errors/error.rb', line 9

def message
  @message
end

#refObject (readonly)

Returns the value of attribute ref.



9
10
11
# File 'lib/glia/errors/error.rb', line 9

def ref
  @ref
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/glia/errors/error.rb', line 9

def type
  @type
end

Instance Method Details

#to_hObject



18
19
20
21
22
# File 'lib/glia/errors/error.rb', line 18

def to_h
  {
    type: type, ref: ref, message: message, error_details: error_details_to_h(@error_details)
  }.compact
end