Class: BSV::Network::Result::Error

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Predicates

#not_found?, #success?

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 = message
  @retryable = retryable
  @metadata = .freeze
  freeze
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



59
60
61
# File 'lib/bsv/network/result.rb', line 59

def message
  @message
end

#metadataObject (readonly)

Returns the value of attribute metadata.



59
60
61
# File 'lib/bsv/network/result.rb', line 59

def 
  @metadata
end

#retryableObject (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) &&
    message == other.message &&
    retryable == other.retryable &&
     == other.
end

#error?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/bsv/network/result.rb', line 68

def error?
  true
end

#hashObject



85
86
87
# File 'lib/bsv/network/result.rb', line 85

def hash
  [self.class, message, retryable, ].hash
end

#retryable?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/bsv/network/result.rb', line 72

def retryable?
  @retryable
end