Exception: JetstreamBridge::RetryExhausted

Inherits:
Error
  • Object
show all
Defined in:
lib/jetstream_bridge/errors.rb

Overview

Raised when all retry attempts have been exhausted.

Instance Attribute Summary collapse

Attributes inherited from Error

#context

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, attempts: 0, original_error: nil, context: {}) ⇒ RetryExhausted

Returns a new instance of RetryExhausted.

Parameters:

  • message (String, nil) (defaults to: nil)

    Human-readable error message (auto-generated if nil)

  • attempts (Integer) (defaults to: 0)

    Number of attempts made

  • original_error (Exception, nil) (defaults to: nil)

    The underlying error

  • context (Hash) (defaults to: {})

    Additional diagnostic context



141
142
143
144
145
146
147
148
# File 'lib/jetstream_bridge/errors.rb', line 141

def initialize(message = nil, attempts: 0, original_error: nil, context: {})
  @attempts = attempts
  @original_error = original_error
  super(
    message || "Failed after #{attempts} attempts: #{original_error&.message}",
    context: context.merge(attempts: attempts).compact
  )
end

Instance Attribute Details

#attemptsInteger (readonly)

Returns Total number of attempts made.

Returns:

  • (Integer)

    Total number of attempts made



133
134
135
# File 'lib/jetstream_bridge/errors.rb', line 133

def attempts
  @attempts
end

#original_errorException? (readonly)

Returns The last error that triggered the retry.

Returns:

  • (Exception, nil)

    The last error that triggered the retry



135
136
137
# File 'lib/jetstream_bridge/errors.rb', line 135

def original_error
  @original_error
end