From e17699d50fa78816daa71585acdaf2a60109b562 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Mon, 28 Dec 2020 16:22:41 +0100 Subject: [PATCH] Improve error message for parsing alignment and orientation --- src/widgets/widget_definitions.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/widgets/widget_definitions.rs b/src/widgets/widget_definitions.rs index bb3e9b3..18e8ea3 100644 --- a/src/widgets/widget_definitions.rs +++ b/src/widgets/widget_definitions.rs @@ -430,7 +430,10 @@ fn parse_orientation(o: &str) -> Result { Ok(match o { "vertical" | "v" => gtk::Orientation::Vertical, "horizontal" | "h" => gtk::Orientation::Horizontal, - _ => bail!("Couldn't parse orientation: '{}'", o), + _ => bail!( + r#"Couldn't parse orientation: '{}'. Possible values are "vertical", "v", "horizontal", "h""#, + o + ), }) } @@ -442,7 +445,10 @@ fn parse_align(o: &str) -> Result { "center" => gtk::Align::Center, "start" => gtk::Align::Start, "end" => gtk::Align::End, - _ => bail!("Couldn't parse alignment: '{}'", o), + _ => bail!( + r#"Couldn't parse alignment: '{}'. Possible values are "fill", "baseline", "center", "start", "end""#, + o + ), }) }