Exception: Symgate::Error

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

Overview

Defines a symgate-specific error so this can be caught by the caller

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Error

Initialises a symgate error from either a string or a savon error



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

def initialize(message)
  super(message)
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail



6
7
8
# File 'lib/symgate/error.rb', line 6

def detail
  @detail
end

#original_errorObject

Returns the value of attribute original_error



6
7
8
# File 'lib/symgate/error.rb', line 6

def original_error
  @original_error
end

Class Method Details

.from_savon(error) ⇒ Object



13
14
15
16
17
18
# File 'lib/symgate/error.rb', line 13

def self.from_savon(error)
  e = Symgate::Error.new(message_from_savon_error(error))

  e.original_error = error
  e
end

.message_from_savon_error(error) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/symgate/error.rb', line 25

def self.message_from_savon_error(error)
  "#{error.message}. #{error.to_hash[:fault][:detail]}"
rescue StandardError
  # :nocov:
  error.message
  # :nocov:
end