class Async::Cancel

Raised when a task is explicitly cancelled.

def cause

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.

@returns [Exception] The cause of the cancel operation.
def cause
	super || @cause
end

def initialize(message = "Task was cancelled")

@parameter message [String | Hash] The error message or a hash containing the cause.

This is a compatibility method for Ruby versions before 3.5 where cause is not propagated correctly when using {Fiber#raise}

Create a new cancel operation.
def initialize(message = "Task was cancelled")
	
	if message.is_a?(Hash)
		@cause = message[:cause]
		message = "Task was cancelled"
	end
	
	super(message)
end