Exception: Emarsys::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/emarsys/error.rb

Overview

Custom error class for rescuing from Emarsys errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, text, status) ⇒ Error

Returns a new instance of Error.



7
8
9
10
11
12
# File 'lib/emarsys/error.rb', line 7

def initialize(code, text, status)
  @code = code
  @text = text
  @status = status
  super(build_error_message)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/emarsys/error.rb', line 5

def code
  @code
end

Instance Method Details

#build_error_messageObject



14
15
16
# File 'lib/emarsys/error.rb', line 14

def build_error_message
  "HTTP-Code: #{@status}, Emarsys-Code: #{@code} - #{@text}"
end