Exception: AtlasRb::StaleResourceError
- Defined in:
- lib/atlas_rb/errors.rb
Overview
Raised when Atlas responds with HTTP 409 + error: "stale_resource",
indicating an optimistic-lock conflict that either (a) exhausted
Atlas's internal retry budget for a retry-safe action, or (b) hit a
retry-unsafe action and surfaced immediately.
Callers (typically ActiveJob subclasses in Cerberus) handle this via:
retry_on AtlasRb::StaleResourceError, attempts: 5, wait: :polynomially_longer
The exception carries the resource_id and action from Atlas's envelope so failure logs are useful without needing the full HTTP response.
Instance Attribute Summary collapse
-
#action ⇒ String?
readonly
The controller action that conflicted, from the envelope (e.g.
"update_thumbnails"). -
#resource_id ⇒ String?
readonly
The conflicted resource's ID, from the envelope.
Instance Method Summary collapse
-
#initialize(message, resource_id: nil, action: nil) ⇒ StaleResourceError
constructor
A new instance of StaleResourceError.
Constructor Details
#initialize(message, resource_id: nil, action: nil) ⇒ StaleResourceError
Returns a new instance of StaleResourceError.
33 34 35 36 37 |
# File 'lib/atlas_rb/errors.rb', line 33 def initialize(, resource_id: nil, action: nil) super() @resource_id = resource_id @action = action end |
Instance Attribute Details
#action ⇒ String? (readonly)
Returns the controller action that conflicted, from the
envelope (e.g. "update_thumbnails").
28 29 30 |
# File 'lib/atlas_rb/errors.rb', line 28 def action @action end |
#resource_id ⇒ String? (readonly)
Returns the conflicted resource's ID, from the envelope.
24 25 26 |
# File 'lib/atlas_rb/errors.rb', line 24 def resource_id @resource_id end |