solana-py icon indicating copy to clipboard operation
solana-py copied to clipboard

How to show meaningful errors

Open AnderUstarroz opened this issue 4 years ago • 3 comments

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.

AnderUstarroz avatar Feb 16 '22 08:02 AnderUstarroz

@michaelhly Can i take this issue on?

migui3230 avatar Apr 13 '22 20:04 migui3230

@AnderUstarroz what file is this in?

migui3230 avatar Apr 15 '22 18:04 migui3230

I am sorry I am not sure what you mean by that. A regular Python file within my project?

AnderUstarroz avatar Apr 18 '22 05:04 AnderUstarroz