Conversation
| .await | ||
| .map_err(|e| e.into()) | ||
| .unwrap_or_else(|err| { | ||
| panic!("executor exited with error: {}", err); |
There was a problem hiding this comment.
Let's return an error instead,
ChainRegistryError::Request() takes in an octocrab::Error
| let status = response.status(); | ||
|
|
||
| if status == 404 { | ||
| panic!("Chain not found in registry") |
There was a problem hiding this comment.
Same here, ChainRegistryError::UnsupportedChain is made for this
| let mut vec = Vec::new(); | ||
| vec.push(chain_info); | ||
|
|
||
| if !chain_content.contains(chain_name) { |
There was a problem hiding this comment.
If the chain exists in the config we can avoid a call to github by putting a check for this before the async block.
| let mut file = fs::OpenOptions::new() | ||
| .append(true) | ||
| .open(config_file) | ||
| .expect("Could not open file"); |
There was a problem hiding this comment.
I think it will be a better UX if the list of chains is in alphabetical order like lens has it, which appending can't accomplish.
I'd forgotten but there is actually an OcularCliConfig struct for serializing/deserializing the config file already in config.rs that can replace the Chains struct in this file. You should be able to deserialize the file to it and edit the chains vec (and sort):
ocular/ocular_cli/src/config.rs
Lines 16 to 24 in 608351f
closes #32