Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better error when a token account isn't created. #7

Open
armaniferrante opened this issue Jun 23, 2021 · 0 comments
Open

Provide better error when a token account isn't created. #7

armaniferrante opened this issue Jun 23, 2021 · 0 comments

Comments

@armaniferrante
Copy link
Contributor

armaniferrante commented Jun 23, 2021

When the program is given a token account that hasn't been initialized (i.e. its data array is zero) the program ungracefully fails. For example,

Program failed to complete 
    Program 11111111111111111111111111111111 invoke [1]
    Program 11111111111111111111111111111111 success
    Program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD invoke [1]
    Program log: libstd rust_begin_panic
    Program log: panicked at 'range end index 32 out of range for slice of length 0', /home/armaniferrante/.cargo/registry/src/github.com-1ecc6299db9ec823/anchor-spl-0.7.0/src/token.rs:256:37
    Program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD consumed 200000 of 200000 compute units
    Program failed to complete: BPF program panicked
    Program 22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD failed: Program failed to complete

Instead, the program should provide an instructive error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant