Skip to main content

handle_remote_command_error

Processes exceptions raised during remote command execution by re-raising Click exceptions or wrapping other errors into a CeleryCommandException with specific exit codes and descriptive error messages.

def handle_remote_command_error(
command: string,
exc: Exception
) - > None

Translates low-level exceptions into user-friendly CeleryCommandException errors with specific exit codes and context-aware messages. This function ensures that connection failures or general execution errors are reported consistently to the CLI user.

Parameters

NameTypeDescription
commandstringThe name of the Celery command that was being executed when the error occurred.
excExceptionThe exception instance caught during command execution, such as an OperationalError or ClickException.

Returns

TypeDescription
NoneNothing is returned; the function always re-raises the original exception or raises a new CeleryCommandException.