interface CommandReturn

The global return type for Command, whether the command is explicit, as in dispatchCommand, or implicit, as in dispatchDirectCommand.

This return type is passed to the caller, but before that happens, it will be processed by the dispatcher to capture any events that need to be emitted.

Properties

events

Any events that have been generated during command execution that should be emitted externally onto the configured topic. By the time the calling code receives the return, the events have already been passed to , and cannot be altered.

Signature
events: EventicleEvent[];

response

An optional response object. This will be ignored by the command dispatcher, and passed through to the calling code. Most commonly used to pass IDs that have been generated during command execution.

Signature
response?: T;

webError

Optional error property.

Used by some implementations to indicate that the Command finished in an Error, which should now be thrown.

This is performed so that the command can emit events (describing the error), and also instruct the calling code (which is normally a synchronous API) to subsequently throw the given Error back to the user.

Signature
webError?: Error;