Skip to content

Commit 12a105a

Browse files
committed
Log HTML rewriting errors
1 parent 482d566 commit 12a105a

File tree

4 files changed

+207
-10
lines changed

4 files changed

+207
-10
lines changed

Cargo.lock

Lines changed: 175 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/html.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub(crate) fn rewrite_lol(
2323

2424
let head_handler = |head: &mut Element| {
2525
head.append(&tera_head, ContentType::Html);
26+
2627
Ok(())
2728
};
2829

@@ -77,11 +78,14 @@ pub(crate) fn rewrite_lol(
7778

7879
// The input and output are always strings, we just use `&[u8]` so we only have to validate once.
7980
let mut buffer = Vec::new();
81+
// TODO: Make the rewriter persistent?
8082
let mut writer = HtmlRewriter::try_new(settings, |bytes: &[u8]| {
8183
buffer.extend_from_slice(bytes);
8284
})
8385
.expect("utf8 is a valid encoding");
86+
8487
writer.write(html)?;
8588
writer.end()?;
89+
8690
Ok(buffer)
8791
}

0 commit comments

Comments
 (0)