aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd/play.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-10-20 02:08:37 -0400
committerJesse Luehrs <doy@tozt.net>2019-10-20 02:08:37 -0400
commit1b73a7643ed290a34e03ed85ead5bd5fee92ed7f (patch)
tree5ded4e30f1b4dbdc7a8c3fa77163bd4812d76dbf /src/cmd/play.rs
parentb1170834339f0f85ae334a889f8a62068d76794a (diff)
downloadteleterm-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.rs12
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)]