diff --git a/gittensor/cli/issue_commands/admin.py b/gittensor/cli/issue_commands/admin.py index 657c5fc2..9efd1a7b 100644 --- a/gittensor/cli/issue_commands/admin.py +++ b/gittensor/cli/issue_commands/admin.py @@ -73,7 +73,7 @@ def admin_cancel(issue_id: int, network: str, rpc_url: str, contract: str, walle if not issue: print_error(f'Issue {issue_id} not found on contract.') - return + raise SystemExit(1) console.print( Panel( @@ -92,6 +92,7 @@ def admin_cancel(issue_id: int, network: str, rpc_url: str, contract: str, walle print_success(f'Issue {issue_id} cancelled successfully!') else: print_error('Cancellation failed.') + raise SystemExit(1) except Exception as e: _handle_command_error(e) @@ -128,7 +129,7 @@ def admin_payout(issue_id: int, network: str, rpc_url: str, contract: str, walle if not issue: print_error(f'Issue {issue_id} not found on contract.') - return + raise SystemExit(1) console.print( Panel( @@ -147,6 +148,7 @@ def admin_payout(issue_id: int, network: str, rpc_url: str, contract: str, walle print_success(f'Payout successful! Amount: {format_alpha(result, 4)} ALPHA') else: print_error('Payout failed.') + raise SystemExit(1) except Exception as e: _handle_command_error(e) @@ -189,6 +191,7 @@ def admin_set_owner(new_owner: str, network: str, rpc_url: str, contract: str, w print_success(f'Ownership transferred to {new_owner}!') else: print_error('Ownership transfer failed.') + raise SystemExit(1) except Exception as e: _handle_command_error(e) @@ -239,6 +242,7 @@ def admin_set_treasury( ) else: print_error('Treasury hotkey update failed.') + raise SystemExit(1) except Exception as e: _handle_command_error(e) @@ -287,6 +291,7 @@ def admin_add_validator(hotkey: str, network: str, rpc_url: str, contract: str, console.print('[yellow]Possible reasons:[/yellow]') console.print(' \u2022 Caller is not the contract owner') console.print(' \u2022 Validator is already whitelisted') + raise SystemExit(1) except Exception as e: _handle_command_error(e) @@ -336,5 +341,6 @@ def admin_remove_validator( console.print('[yellow]Possible reasons:[/yellow]') console.print(' \u2022 Caller is not the contract owner') console.print(' \u2022 Validator is not in the whitelist') + raise SystemExit(1) except Exception as e: _handle_command_error(e) diff --git a/gittensor/cli/issue_commands/mutations.py b/gittensor/cli/issue_commands/mutations.py index 05eb5db0..6e0df49c 100644 --- a/gittensor/cli/issue_commands/mutations.py +++ b/gittensor/cli/issue_commands/mutations.py @@ -375,13 +375,17 @@ def issue_harvest(wallet_name: str, wallet_hotkey: str, network: str, rpc_url: s console.print(f'[cyan]Transaction hash:[/cyan] {result.get("tx_hash", "N/A")}') print_error(result.get('error', 'Unknown')) console.print('[dim]Check proxy permissions: contract needs NonCritical proxy.[/dim]') - elif result.get('status') == 'failed': + raise SystemExit(1) + elif result.get('status') in {'failed', 'error'}: print_error(f'Harvest failed: {result.get("error", "Unknown error")}') + raise SystemExit(1) else: console.print(f'\n[yellow]Harvest result: {result}[/yellow]') + raise SystemExit(1) else: print_error('Harvest returned None — check logs for details.') console.print('[dim]Run with --verbose for more information.[/dim]') + raise SystemExit(1) except ImportError as e: print_error(f'Missing dependency — {e}') diff --git a/gittensor/cli/issue_commands/vote.py b/gittensor/cli/issue_commands/vote.py index d9c700dc..7f731995 100644 --- a/gittensor/cli/issue_commands/vote.py +++ b/gittensor/cli/issue_commands/vote.py @@ -143,6 +143,7 @@ def val_vote_solution( print_success('Solution vote submitted!') else: print_error('Vote failed.') + raise SystemExit(1) except Exception as e: _handle_command_error(e) @@ -196,6 +197,7 @@ def val_vote_cancel_issue( print_success('Cancel vote submitted!') else: print_error('Cancel vote failed.') + raise SystemExit(1) except Exception as e: _handle_command_error(e)