Exception: Aeternitas::Guard::GuardIsLocked
- Inherits:
-
StandardError
- Object
- StandardError
- Aeternitas::Guard::GuardIsLocked
- Defined in:
- lib/aeternitas/guard.rb
Overview
Custom error class thrown when the lock can not be acquired
Instance Attribute Summary collapse
-
#timeout ⇒ DateTime
readonly
The locks current timeout.
Instance Method Summary collapse
-
#initialize(resource_id, timeout, reason = nil) ⇒ GuardIsLocked
constructor
A new instance of GuardIsLocked.
Constructor Details
#initialize(resource_id, timeout, reason = nil) ⇒ GuardIsLocked
Returns a new instance of GuardIsLocked.
158 159 160 161 162 163 |
# File 'lib/aeternitas/guard.rb', line 158 def initialize(resource_id, timeout, reason = nil) msg = "Resource '#{resource_id}' is locked until #{timeout}." msg += " Reason: #{reason}" if reason super(msg) @timeout = timeout end |
Instance Attribute Details
#timeout ⇒ DateTime (readonly)
Returns the locks current timeout.
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/aeternitas/guard.rb', line 155 class GuardIsLocked < StandardError attr_reader :timeout def initialize(resource_id, timeout, reason = nil) msg = "Resource '#{resource_id}' is locked until #{timeout}." msg += " Reason: #{reason}" if reason super(msg) @timeout = timeout end end |