Class: BSV::Network::Result::Error
- Inherits:
-
Object
- Object
- BSV::Network::Result::Error
- Includes:
- Predicates
- Defined in:
- lib/bsv/network/result.rb
Overview
Represents a failed outcome. Carries a human-readable message, a boolean retryable flag indicating whether the caller should retry, and optional metadata for structured protocol-specific details (e.g. arc_status).
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#retryable ⇒ Object
readonly
Returns the value of attribute retryable.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #error? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(message:, retryable: false, metadata: {}) ⇒ Error
constructor
A new instance of Error.
- #retryable? ⇒ Boolean
Methods included from Predicates
Constructor Details
#initialize(message:, retryable: false, metadata: {}) ⇒ Error
Returns a new instance of Error.
61 62 63 64 65 66 |
# File 'lib/bsv/network/result.rb', line 61 def initialize(message:, retryable: false, metadata: {}) @message = @retryable = retryable @metadata = .freeze freeze end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
59 60 61 |
# File 'lib/bsv/network/result.rb', line 59 def @message end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
59 60 61 |
# File 'lib/bsv/network/result.rb', line 59 def @metadata end |
#retryable ⇒ Object (readonly)
Returns the value of attribute retryable.
59 60 61 |
# File 'lib/bsv/network/result.rb', line 59 def retryable @retryable end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
76 77 78 79 80 81 |
# File 'lib/bsv/network/result.rb', line 76 def ==(other) other.is_a?(Error) && == other. && retryable == other.retryable && == other. end |
#error? ⇒ Boolean
68 69 70 |
# File 'lib/bsv/network/result.rb', line 68 def error? true end |
#hash ⇒ Object
85 86 87 |
# File 'lib/bsv/network/result.rb', line 85 def hash [self.class, , retryable, ].hash end |
#retryable? ⇒ Boolean
72 73 74 |
# File 'lib/bsv/network/result.rb', line 72 def retryable? @retryable end |