Exception: Remitmd::RemitError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/remitmd/errors.rb

Overview

Structured error raised by all remit.md SDK operations.

Every error has a machine-readable code, a human-readable message with actionable context, and a doc_url pointing to the specific error documentation.

Examples:

begin
  wallet.pay("not-an-address", 1.00)
rescue Remitmd::RemitError => e
  puts e.code     # => "INVALID_ADDRESS"
  puts e.message  # => "[INVALID_ADDRESS] expected 0x-prefixed ..."
  puts e.doc_url  # => "https://remit.md/docs/api-reference/error-codes#invalid_address"
end

Direct Known Subclasses

AllowanceExceededError

Constant Summary collapse

INVALID_SIGNATURE =

Error code constants - matches TS SDK (28 codes) Auth errors

"INVALID_SIGNATURE"
NONCE_REUSED =
"NONCE_REUSED"
TIMESTAMP_EXPIRED =
"TIMESTAMP_EXPIRED"
UNAUTHORIZED =
"UNAUTHORIZED"
INSUFFICIENT_BALANCE =

Balance / funds

"INSUFFICIENT_BALANCE"
BELOW_MINIMUM =
"BELOW_MINIMUM"
ESCROW_NOT_FOUND =

Escrow errors

"ESCROW_NOT_FOUND"
ESCROW_ALREADY_FUNDED =
"ESCROW_ALREADY_FUNDED"
ESCROW_EXPIRED =
"ESCROW_EXPIRED"
INVALID_INVOICE =

Invoice errors

"INVALID_INVOICE"
DUPLICATE_INVOICE =
"DUPLICATE_INVOICE"
SELF_PAYMENT =
"SELF_PAYMENT"
INVALID_PAYMENT_TYPE =
"INVALID_PAYMENT_TYPE"
TAB_DEPLETED =

Tab errors

"TAB_DEPLETED"
TAB_EXPIRED =
"TAB_EXPIRED"
TAB_NOT_FOUND =
"TAB_NOT_FOUND"
STREAM_NOT_FOUND =

Stream errors

"STREAM_NOT_FOUND"
RATE_EXCEEDS_CAP =
"RATE_EXCEEDS_CAP"
BOUNTY_EXPIRED =

Bounty errors

"BOUNTY_EXPIRED"
BOUNTY_CLAIMED =
"BOUNTY_CLAIMED"
BOUNTY_MAX_ATTEMPTS =
"BOUNTY_MAX_ATTEMPTS"
BOUNTY_NOT_FOUND =
"BOUNTY_NOT_FOUND"
CHAIN_MISMATCH =

Chain errors

"CHAIN_MISMATCH"
CHAIN_UNSUPPORTED =
"CHAIN_UNSUPPORTED"
RATE_LIMITED =

Rate limiting

"RATE_LIMITED"
CANCEL_BLOCKED_CLAIM_START =

Cancellation errors

"CANCEL_BLOCKED_CLAIM_START"
CANCEL_BLOCKED_EVIDENCE =
"CANCEL_BLOCKED_EVIDENCE"
VERSION_MISMATCH =

Protocol errors

"VERSION_MISMATCH"
NETWORK_ERROR =
"NETWORK_ERROR"
INVALID_ADDRESS =

Legacy aliases (kept for backward compat within the SDK)

"INVALID_ADDRESS"
INVALID_AMOUNT =
"INVALID_AMOUNT"
INSUFFICIENT_FUNDS =
INSUFFICIENT_BALANCE
SERVER_ERROR =
"SERVER_ERROR"
DEPOSIT_NOT_FOUND =
"DEPOSIT_NOT_FOUND"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message, context: {}) ⇒ RemitError

Returns a new instance of RemitError.



79
80
81
82
83
84
# File 'lib/remitmd/errors.rb', line 79

def initialize(code, message, context: {})
  @code    = code
  @doc_url = "https://remit.md/docs/api-reference/error-codes##{code.downcase}"
  @context = context
  super("[#{code}] #{message} - #{@doc_url}")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



77
78
79
# File 'lib/remitmd/errors.rb', line 77

def code
  @code
end

#contextObject (readonly)

Returns the value of attribute context.



77
78
79
# File 'lib/remitmd/errors.rb', line 77

def context
  @context
end

#doc_urlObject (readonly)

Returns the value of attribute doc_url.



77
78
79
# File 'lib/remitmd/errors.rb', line 77

def doc_url
  @doc_url
end