From 6f5e901677f94e9dd5de7bb93b87769d62079d36 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 16 Oct 2024 11:38:20 -0700 Subject: [PATCH] chore: remove `unwrap` call in favor of an explicit error message. --- src/commands/format.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/format.rs b/src/commands/format.rs index 2e0eb45..dfd4334 100644 --- a/src/commands/format.rs +++ b/src/commands/format.rs @@ -85,7 +85,13 @@ pub fn format(args: FormatArgs) -> Result<()> { ); } - let document = Node::Ast(document.ast().into_v1().unwrap()).into_format_element(); + let document = Node::Ast( + document + .ast() + .into_v1() + .ok_or_else(|| anyhow!("only WDL 1.x documents are currently supported"))?, + ) + .into_format_element(); let config = Builder::default() .indent(if args.with_tabs { Indent::Tabs(NonZeroUsize::new(1).unwrap())