class Async::Stop

Raised when a task is explicitly stopped.

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 stop operation.
def cause
	super || @cause
end

def initialize(message = "Task was stopped")

@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 stop operation.
def initialize(message = "Task was stopped")
	if message.is_a?(Hash)
		@cause = message[:cause]
		message = "Task was stopped"
	end
	
	super(message)
end