Class: BitWallet::HandlesError
- Inherits:
-
Object
- Object
- BitWallet::HandlesError
- Defined in:
- lib/bit_wallet/handles_error.rb
Class Method Summary collapse
Class Method Details
.from(message) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/bit_wallet/handles_error.rb', line 4 def self.from() error = if .include?("-6") InsufficientFunds.new("cannot send an amount more than what this account has") elsif .include?("-3") InvalidAmount.new("amount is invalid") elsif .include?("-5") InvalidAddress.new("bitcoin address is invalid") else ArgumentError.new("unknown error: #{message}") end fail error if error end |