Skip to content

Commit

Permalink
hotfix: don't fail on invalid font-awesome icons, just report
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Sep 23, 2024
1 parent 3316e90 commit bf50495
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/web/page/templates.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::error::Result;
use crate::web::rustdoc::RustdocPage;
use anyhow::Context;
use crate::web::{report_error, rustdoc::RustdocPage};
use anyhow::{anyhow, Context};
use rinja::Template;
use std::{fmt, sync::Arc};
use tracing::trace;
Expand Down Expand Up @@ -267,8 +267,16 @@ impl IconType {
IconType::Brand => font_awesome_as_a_crate::Type::Brands,
};

let icon_file_string = font_awesome_as_a_crate::svg(type_, icon_name)
.map_err(|err| rinja::Error::Custom(Box::new(err)))?;
let icon_file_string = match font_awesome_as_a_crate::svg(type_, icon_name) {
Ok(s) => s,
Err(err) => {
report_error(&anyhow!(err).context(format!(
"error trying to render icon with name \"{}\"",
icon_name
)));
""
}
};

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

0 comments on commit bf50495

Please sign in to comment.