Skip to content

Commit de1f9e7

Browse files
committed
hotfix: don't fail on invalid font-awesome icons, just report
1 parent 3316e90 commit de1f9e7

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/web/page/templates.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::Result;
2-
use crate::web::rustdoc::RustdocPage;
3-
use anyhow::Context;
2+
use crate::web::{report_error, rustdoc::RustdocPage};
3+
use anyhow::{anyhow, Context};
44
use rinja::Template;
55
use std::{fmt, sync::Arc};
66
use tracing::trace;
@@ -267,8 +267,16 @@ impl IconType {
267267
IconType::Brand => font_awesome_as_a_crate::Type::Brands,
268268
};
269269

270-
let icon_file_string = font_awesome_as_a_crate::svg(type_, icon_name)
271-
.map_err(|err| rinja::Error::Custom(Box::new(err)))?;
270+
let icon_file_string = match font_awesome_as_a_crate::svg(type_, icon_name) {
271+
Ok(s) => s,
272+
Err(err) => {
273+
report_error(&anyhow!(err).context(format!(
274+
"error trying to render icon with name \"{}\"",
275+
icon_name
276+
)));
277+
""
278+
}
279+
};
272280

273281
let mut classes = vec!["fa-svg"];
274282
if fw {

0 commit comments

Comments
 (0)