solana-py
solana-py copied to clipboard
How to show meaningful errors
Is there a way to get meaningful errors out of the exceptions? For instance If I try to create a token and token account but having not funds:
conn = Client(network_url)
try:
token_client = TokenClient(conn, my_pubkey, TOKEN_PROGRAM_ID, my_keypair)
token = token_client.create_mint(
conn=conn,
payer=my_keypair,
mint_authority=my_pubkey,
decimals=0,
program_id=TOKEN_PROGRAM_ID,
skip_confirmation=False
)
token_client = TokenClient(conn, token.pubkey, TOKEN_PROGRAM_ID, my_keypair)
account = token_client.create_account(my_pubkey)
except Exception as e:
print(e)
This will throw: Unable to confirm transaction K9dEoLgOX5m7vWxquhbLCQGDLBVkNb1ty356AaR2w7WffrZrWep9ENhuj1YA794NUfpBbR5oYsF8VT38ExWVcfv
But nothing about the missing balance.
@michaelhly Can i take this issue on?
@AnderUstarroz what file is this in?
I am sorry I am not sure what you mean by that. A regular Python file within my project?