| 121 | |
| 122 | |
| 123 | def handle_remote_command_error(command: str, exc: Exception) -> None: |
| 124 | if isinstance(exc, click.ClickException): |
| 125 | raise |
| 126 | |
| 127 | if isinstance(exc, OperationalError): |
| 128 | raise CeleryCommandException( |
| 129 | message=( |
| 130 | 'Could not connect to the message broker. ' |
| 131 | 'Please make sure your broker (e.g., RabbitMQ or Redis) is running and ' |
| 132 | f'the connection settings are correct. Reason: {exc}' |
| 133 | ), |
| 134 | exit_code=EX_UNAVAILABLE, |
| 135 | ) from exc |
| 136 | |
| 137 | raise CeleryCommandException( |
| 138 | message=f'Unable to run the `{command}` command. Reason: {exc}', |
| 139 | exit_code=EX_UNAVAILABLE, |
| 140 | ) from exc |
| 141 | |
| 142 | |
| 143 | def handle_preload_options(f): |