Exception: Ask::TokenUsage::InsufficientTokens

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ask/token_usage/insufficient_tokens.rb

Overview

Raised when a spend is attempted but the wallet has insufficient tokens. Also fired to the configured on_insufficient callback before raising.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(required:, available:) ⇒ InsufficientTokens

Returns a new instance of InsufficientTokens.



11
12
13
14
15
# File 'lib/ask/token_usage/insufficient_tokens.rb', line 11

def initialize(required:, available:)
  @required = required
  @available = available
  super("Insufficient tokens: need #{required}, have #{available}")
end

Instance Attribute Details

#availableObject (readonly)

Returns the value of attribute available.



9
10
11
# File 'lib/ask/token_usage/insufficient_tokens.rb', line 9

def available
  @available
end

#requiredObject (readonly)

Returns the value of attribute required.



9
10
11
# File 'lib/ask/token_usage/insufficient_tokens.rb', line 9

def required
  @required
end