From bf504953787879d4c9416c0ce08c8a490c03a8fd Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Mon, 23 Sep 2024 17:17:56 +0200 Subject: [PATCH] hotfix: don't fail on invalid font-awesome icons, just report --- src/web/page/templates.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/web/page/templates.rs b/src/web/page/templates.rs index 90fe7df99..60f835a8b 100644 --- a/src/web/page/templates.rs +++ b/src/web/page/templates.rs @@ -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; @@ -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 {