Exception: Insika::BudgetExceeded
- Defined in:
- lib/insika/errors.rb
Overview
The hard budget refused the turn (WS2): the (tenant, agent) spend in the
window already met its cap BEFORE the turn ran. A typed, retryable failure —
the envelope reads budget_exceeded + retry_after (seconds until the
window rolls) — never a silent drop. window is :daily | :monthly.
Instance Attribute Summary collapse
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #classification ⇒ Object
-
#initialize(message = nil, window: nil, retry_after: nil) ⇒ BudgetExceeded
constructor
A new instance of BudgetExceeded.
Constructor Details
#initialize(message = nil, window: nil, retry_after: nil) ⇒ BudgetExceeded
Returns a new instance of BudgetExceeded.
62 63 64 65 66 |
# File 'lib/insika/errors.rb', line 62 def initialize( = nil, window: nil, retry_after: nil) @window = window @retry_after = retry_after super( || "budget exceeded (#{window})") end |
Instance Attribute Details
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
60 61 62 |
# File 'lib/insika/errors.rb', line 60 def retry_after @retry_after end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
60 61 62 |
# File 'lib/insika/errors.rb', line 60 def window @window end |
Instance Method Details
#classification ⇒ Object
68 69 70 |
# File 'lib/insika/errors.rb', line 68 def classification { kind: :budget_exceeded, retryable: true, retry_after: retry_after }.compact end |