diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-20 02:08:37 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-20 02:08:37 -0400 |
commit | 1b73a7643ed290a34e03ed85ead5bd5fee92ed7f (patch) | |
tree | 5ded4e30f1b4dbdc7a8c3fa77163bd4812d76dbf /src/cmd/play.rs | |
parent | b1170834339f0f85ae334a889f8a62068d76794a (diff) | |
download | teleterm-1b73a7643ed290a34e03ed85ead5bd5fee92ed7f.tar.gz teleterm-1b73a7643ed290a34e03ed85ead5bd5fee92ed7f.zip |
exit with an error if we fail to parse the config file
just using the defaults is confusing for subcommands that don't display
errors by default (stream, record, etc)
Diffstat (limited to 'src/cmd/play.rs')
-rw-r--r-- | src/cmd/play.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cmd/play.rs b/src/cmd/play.rs index 2e41816..7f6657b 100644 --- a/src/cmd/play.rs +++ b/src/cmd/play.rs @@ -27,11 +27,13 @@ pub fn cmd<'a, 'b>(app: clap::App<'a, 'b>) -> clap::App<'a, 'b> { crate::config::Ttyrec::cmd(app.about("Play recorded terminal sessions")) } -pub fn config(config: config::Config) -> Box<dyn crate::config::Config> { - Box::new(config.try_into().unwrap_or_else(|e| { - log::warn!("failed to parse config data: {}", e); - Config::default() - })) +pub fn config( + config: config::Config, +) -> Result<Box<dyn crate::config::Config>> { + let config: Config = config + .try_into() + .context(crate::error::CouldntParseConfig)?; + Ok(Box::new(config)) } #[allow(clippy::large_enum_variant)] |