Skip to main content
Raise from a command handler to answer its caller with a failure. The code and the message cross the wire unchanged, correlated with that command, so an awaiting client rejects with a reason instead of waiting for a reply that never comes.
Signature
Write the message for the client, not for a log. Any other exception is treated as a bug: the runtime logs the traceback and answers with a generic internal_error, keeping the detail out of the reply. 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.