toResult

Converts a WaitSignal to a CommandResult.

This extension function transforms a wait signal into a command result, mapping all the signal properties to the corresponding result fields.

Return

a CommandResult representing the wait signal

Parameters

commandMessage

the original command message

See also


fun Throwable.toResult(waitCommandId: String, commandMessage: CommandMessage<*>, function: FunctionInfoData = COMMAND_GATEWAY_FUNCTION, id: String = generateGlobalId(), stage: CommandStage = CommandStage.SENT, result: Map<String, Any> = emptyMap(), signalTime: Long = System.currentTimeMillis()): CommandResult

Converts a Throwable to a CommandResult representing a command failure.

This extension function creates a CommandResult from an exception, extracting error information and populating the result with failure details.

Return

a CommandResult representing the failure

Parameters

waitCommandId

the ID of the command being waited on

commandMessage

the original command message that failed

function

the function information (defaults to command gateway)

id

unique identifier for the result (auto-generated if not provided)

stage

the command stage when the error occurred (defaults to SENT)

result

additional result data (defaults to empty map)

signalTime

timestamp of the error (defaults to current time)

See also