diff --git a/bittensor_cli/src/bittensor/utils.py b/bittensor_cli/src/bittensor/utils.py index 41a120b63..7995963c3 100644 --- a/bittensor_cli/src/bittensor/utils.py +++ b/bittensor_cli/src/bittensor/utils.py @@ -850,7 +850,7 @@ def normalize_hyperparameters( norm_value = norm_value.to_dict() else: norm_value = value - except Exception: + except (KeyError, ValueError, TypeError, AttributeError): # bittensor.logging.warning(f"Error normalizing parameter '{param}': {e}") norm_value = "-" if not json_output: @@ -1728,7 +1728,7 @@ def is_valid_github_url(url: str) -> bool: return False return True - except Exception: # TODO figure out the exceptions that can be raised in here + except (ValueError, TypeError, AttributeError): return False diff --git a/bittensor_cli/src/commands/wallets.py b/bittensor_cli/src/commands/wallets.py index 96c812be5..50b66a5a6 100644 --- a/bittensor_cli/src/commands/wallets.py +++ b/bittensor_cli/src/commands/wallets.py @@ -377,7 +377,7 @@ async def new_hotkey( if uri: try: keypair = Keypair.create_from_uri(uri) - except Exception as e: + except TypeError as e: print_error(f"Failed to create keypair from URI {uri}: {str(e)}") return wallet.set_hotkey(keypair=keypair, encrypt=use_password) @@ -428,7 +428,7 @@ async def new_coldkey( if uri: try: keypair = Keypair.create_from_uri(uri) - except Exception as e: + except TypeError as e: print_error(f"Failed to create keypair from URI {uri}: {str(e)}") wallet.set_coldkey(keypair=keypair, encrypt=False, overwrite=False) wallet.set_coldkeypub(keypair=keypair, encrypt=False, overwrite=False) @@ -501,7 +501,7 @@ async def wallet_create( "hotkey_ss58": wallet.hotkeypub.ss58_address, "coldkey_ss58": wallet.coldkeypub.ss58_address, } - except Exception as e: + except (ValueError, TypeError, KeyFileError) as e: err = f"Failed to create keypair from URI: {str(e)}" print_error(err) output_dict["error"] = err