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

open_genesis_config should return a human-friendly error #1176

Closed
wants to merge 2 commits into from

Conversation

james-chf
Copy link
Contributor

@james-chf james-chf commented Jun 27, 2022

Give a slightly better error message when anomac or anomaw commands are run, but a chain hasn't been joined. Before we would just get No such file or directory (os error 2), now we should indicate that specifically we can't read a genesis config file.

mbp> target/debug/anomac epoch
2022-07-07T16:58:56.136364Z  INFO anoma_apps::cli::context: Chain ID: anoma-internal.000000000000000
Error: 
   0: couldn't read genesis config file from .anoma/anoma-internal.000000000000000.toml
   1: No such file or directory (os error 2)

Location:
   apps/src/lib/config/genesis.rs:601

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
[1] - 2022-07-07 17:58:56

This PR also makes some changes such that we can propagate an error all the way back up to main() of anomac, anoman, anomaw, so that it will be easier in the future to propagate errors like this. (Relates to anoma/anoma#1049)

To close anoma/namada#97, we should catch the error and translate it to a friendly message such as one indicating to the user to join a network first, rather than panicking with a backtrace.

@tzemanovic
Copy link
Member

moved to anoma/namada#291

@tzemanovic tzemanovic closed this Aug 8, 2022
@james-chf james-chf deleted the james/genesis-config-error branch October 13, 2022 16:37
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

Successfully merging this pull request may close these issues.

anoma commands should hint to join a chain on first use rather than panicking
2 participants