Exception: Tosspayments2::Rails::APIError

Inherits:
Error
  • Object
show all
Defined in:
lib/tosspayments2/rails/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status:, body: nil, request_id: nil) ⇒ APIError

Returns a new instance of APIError.



12
13
14
15
16
17
18
# File 'lib/tosspayments2/rails/errors.rb', line 12

def initialize(message, status:, body: nil, request_id: nil)
  super(message)
  @status = status
  @body = body
  @code = (body && body[:code]) || (body && body[:errorCode])
  @request_id = request_id || (body && body[:request_id])
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



10
11
12
# File 'lib/tosspayments2/rails/errors.rb', line 10

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



10
11
12
# File 'lib/tosspayments2/rails/errors.rb', line 10

def code
  @code
end

#request_idObject (readonly)

Returns the value of attribute request_id.



10
11
12
# File 'lib/tosspayments2/rails/errors.rb', line 10

def request_id
  @request_id
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/tosspayments2/rails/errors.rb', line 10

def status
  @status
end