Exception: Async::Cancel
- Inherits:
-
Exception
- Object
- Exception
- Async::Cancel
- Defined in:
- lib/async/cancel.rb
Overview
Raised when a task is explicitly cancelled.
Defined Under Namespace
Instance Method Summary collapse
-
#cause ⇒ Object
This is a compatibility method for Ruby versions before 3.5 where cause is not propagated correctly when using Fiber#raise, we explicitly capture the cause here.
-
#initialize(message = "Task was cancelled") ⇒ Cancel
constructor
Create a new cancel operation.
Constructor Details
#initialize(message = "Task was cancelled") ⇒ Cancel
Create a new cancel operation.
This is a compatibility method for Ruby versions before 3.5 where cause is not propagated correctly when using Fiber#raise
40 41 42 43 44 45 46 47 48 |
# File 'lib/async/cancel.rb', line 40 def initialize( = "Task was cancelled") if .is_a?(Hash) @cause = [:cause] = "Task was cancelled" end super() end |
Instance Method Details
#cause ⇒ Object
This is a compatibility method for Ruby versions before 3.5 where cause is not propagated correctly when using Fiber#raise, we explicitly capture the cause here.
53 54 55 |
# File 'lib/async/cancel.rb', line 53 def cause super || @cause end |