Skip to content

Commit

Permalink
cleanup control flow, error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
darrell-roberts committed Nov 24, 2024
1 parent aea8027 commit 8031139
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ fn main() -> anyhow::Result<()> {
let config_file = options.config_file.as_deref();

if options.output.generate_config {
let config = override_configuration(Config::default(), &options)?;
config::store_config(&config, config_file).context("Failed to create new config file")?;
return Ok(());
override_configuration(Config::default(), &options)
.and_then(|config| config::store_config(&config, config_file))
.inspect_err(|err| error!("typeshare failed to create new config file: {err}"))
} else {
generate_types(config_file, &options).inspect_err(|err| {
error!("typeshare failed to generate types: {err}");
})
}

generate_types(config_file, &options).inspect_err(|err| {
error!("Typeshare failed to generate types: {err}");
})
}

fn generate_types(config_file: Option<&Path>, options: &Args) -> anyhow::Result<()> {
Expand Down

0 comments on commit 8031139

Please sign in to comment.