diff --git a/cli/src/templater.rs b/cli/src/templater.rs index 24a8e84b2..0b6a5c2e3 100644 --- a/cli/src/templater.rs +++ b/cli/src/templater.rs @@ -415,8 +415,7 @@ impl> TemplateProperty for PlainTextFormattedProperty { self.template .format(context, &mut PlainTextFormatter::new(&mut output)) .expect("write() to PlainTextFormatter should never fail"); - // TODO: Use from_utf8_lossy() if we added template that embeds file content - Ok(String::from_utf8(output).expect("template output should be utf-8 bytes")) + Ok(String::from_utf8(output).map_err(|err| err.utf8_error())?) } }