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