Exception: Tasker::RetryableError

Inherits:
ProceduralError show all
Defined in:
lib/tasker/errors.rb

Overview

Error indicating a step failed but should be retried with backoff

Use this error when an operation fails due to temporary conditions like:

  • Network timeouts

  • Rate limiting (429 status)

  • Server errors (5xx status)

  • Temporary service unavailability

Examples:

Basic retryable error

raise Tasker::RetryableError, "Payment service timeout"

With retry delay

raise Tasker::RetryableError.new("Rate limited", retry_after: 60)

With context for monitoring

raise Tasker::RetryableError.new(
  "External API unavailable",
  retry_after: 30,
  context: { service: 'billing_api', error_code: 503 }
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, retry_after: nil, context: {}) ⇒ RetryableError



43
44
45
46
47
# File 'lib/tasker/errors.rb', line 43

def initialize(message, retry_after: nil, context: {})
  super(message)
  @retry_after = retry_after
  @context = context
end

Instance Attribute Details

#contextHash (readonly)



38
39
40
# File 'lib/tasker/errors.rb', line 38

def context
  @context
end

#retry_afterInteger? (readonly)



35
36
37
# File 'lib/tasker/errors.rb', line 35

def retry_after
  @retry_after
end