Exception: MultiSafePay::RequestError

Inherits:
Exception
  • Object
show all
Defined in:
lib/multisafepay/exception.rb

Direct Known Subclasses

ResourceNotFoundError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, response = nil) ⇒ RequestError

Returns a new instance of RequestError.



8
9
10
11
12
13
# File 'lib/multisafepay/exception.rb', line 8

def initialize(error, response = nil)
  exception.error_code = error['error_code']
  exception.error_info  = error['error_info']

  self.response = response
end

Instance Attribute Details

#error_code ⇒ Object

Returns the value of attribute error_code.



6
7
8
# File 'lib/multisafepay/exception.rb', line 6

def error_code
  @error_code
end

#error_info ⇒ Object

Returns the value of attribute error_info.



6
7
8
# File 'lib/multisafepay/exception.rb', line 6

def error_info
  @error_info
end

Instance Method Details

#http_body ⇒ Object



23
24
25
# File 'lib/multisafepay/exception.rb', line 23

def http_body
  response.body if response
end

#http_headers ⇒ Object



19
20
21
# File 'lib/multisafepay/exception.rb', line 19

def http_headers
  response.to_hash if response
end

#to_s ⇒ Object



15
16
17
# File 'lib/multisafepay/exception.rb', line 15

def to_s
  "#{error_code}: #{error_info}"
end