Exception: Insika::CircuitOpenError

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

Overview

The circuit breaker refused the turn WITHOUT touching the provider (WS3): the (tenant, provider/model) saw after failures within within seconds. Typed + retryable — the envelope reads circuit_open + retry_after (seconds until the cooldown lets a half-open trial through).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, ref: nil, retry_after: nil) ⇒ CircuitOpenError

Returns a new instance of CircuitOpenError.



80
81
82
83
84
# File 'lib/insika/errors.rb', line 80

def initialize(message = nil, ref: nil, retry_after: nil)
  @ref = ref
  @retry_after = retry_after
  super(message || "circuit open for #{ref}")
end

Instance Attribute Details

#refObject (readonly)

Returns the value of attribute ref.



78
79
80
# File 'lib/insika/errors.rb', line 78

def ref
  @ref
end

#retry_afterObject (readonly)

Returns the value of attribute retry_after.



78
79
80
# File 'lib/insika/errors.rb', line 78

def retry_after
  @retry_after
end

Instance Method Details

#classificationObject



86
87
88
# File 'lib/insika/errors.rb', line 86

def classification
  { kind: :circuit_open, retryable: true, retry_after: retry_after }.compact
end