send_command() raises a ReactorError. A JavaScript caller’s sendCommand() resolves
undefined and reports the failure on its error event.
Signature
code is a short, stable snake_case token that a client branches on. Name each code in the
command’s description. Write message for the client, not for a log.
Never refuse a command by sending an error message and returning. The runtime then answers the
caller as on success. Other clients receive a message about a command they did not send. A session
started with a step count keeps running with nothing to do. A raise from one of its starting
commands ends that session and fails its remaining steps. See
Reporting a failure.
The runtime treats any other exception as a bug. It logs the traceback and answers with a generic
internal_error, so the detail stays out of the reply. Catch what a check raises, and raise a
CommandError with your own code instead.
The runtime sends two codes of its own on the same channel: invalid_command when a payload fails
validation and no handler runs, and unresolved_upload when a command references a file that
cannot be fetched.