forked from mirrors/jj
templater: translate UTF-8 conversion error to runtime error
This isn't a problem as of now, but we'll probably add commit.diff() or something later.
This commit is contained in:
parent
26c182a0b0
commit
aa79582092
1 changed files with 1 additions and 2 deletions
|
@ -415,8 +415,7 @@ impl<C, T: Template<C>> TemplateProperty<C> for PlainTextFormattedProperty<T> {
|
|||
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())?)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue