Exception: BSV::Wallet::Error
- Inherits:
-
StandardError
- Object
- StandardError
- BSV::Wallet::Error
- Defined in:
- lib/bsv/wallet/errors.rb
Overview
Base error for all wallet operations. Carries a machine-readable code per the BRC-100 error structure and a wire-protocol stack string.
Direct Known Subclasses
InsufficientFundsError, InvalidHmacError, InvalidParameterError, InvalidSignatureError, ReviewActionsError, UnsupportedActionError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#wallet_stack ⇒ Object
readonly
Returns the value of attribute wallet_stack.
Instance Method Summary collapse
-
#initialize(message = nil, code: 1, stack: '') ⇒ Error
constructor
A new instance of Error.
-
#to_wire ⇒ Object
Serialise to a hash suitable for embedding in a wire result frame.
Constructor Details
#initialize(message = nil, code: 1, stack: '') ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 |
# File 'lib/bsv/wallet/errors.rb', line 10 def initialize( = nil, code: 1, stack: '') @code = code @wallet_stack = stack super( || '') end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/bsv/wallet/errors.rb', line 8 def code @code end |
#wallet_stack ⇒ Object (readonly)
Returns the value of attribute wallet_stack.
8 9 10 |
# File 'lib/bsv/wallet/errors.rb', line 8 def wallet_stack @wallet_stack end |
Instance Method Details
#to_wire ⇒ Object
Serialise to a hash suitable for embedding in a wire result frame. Never leaks Ruby’s internal backtrace — only the wallet_stack string.
18 19 20 |
# File 'lib/bsv/wallet/errors.rb', line 18 def to_wire { code: code, message: .to_s, stack: wallet_stack.to_s } end |