Exception: Anakin::InsufficientCreditsError

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

Overview

402 — out of credits. balance / required carry the failure context.

Instance Attribute Summary collapse

Attributes inherited from Error

#code, #status

Instance Method Summary collapse

Constructor Details

#initialize(message, status: 402, code: nil, balance: 0, required: 0) ⇒ InsufficientCreditsError

Returns a new instance of InsufficientCreditsError.



21
22
23
24
25
# File 'lib/anakin/errors.rb', line 21

def initialize(message, status: 402, code: nil, balance: 0, required: 0)
  super(message, status: status, code: code)
  @balance = balance
  @required = required
end

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



19
20
21
# File 'lib/anakin/errors.rb', line 19

def balance
  @balance
end

#requiredObject (readonly)

Returns the value of attribute required.



19
20
21
# File 'lib/anakin/errors.rb', line 19

def required
  @required
end