Skip to content

Commit 923cb62

Browse files
committed
icon image helper: logging and error handling
- Changed debug logs to warning logs for invalid icon names and missing icons in the IconImgHelper. - Updated the way icons are retrieved from the ICON_MAP for better clarity and performance.
1 parent 1db0868 commit 923cb62

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/template_helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ impl HelperDef for IconImgHelper {
230230
let name = match params[0] {
231231
JsonValue::String(s) => s,
232232
other => {
233-
log::debug!("icon_img: {other:?} is not an icon name, not rendering anything");
233+
log::warn!("icon_img: {other:?} is not an icon name, not rendering anything");
234234
return Ok(());
235235
}
236236
};
237237
let size = params[1].as_u64().unwrap_or(24);
238238

239-
let Some(inner_content) = icons::ICON_MAP.get(name).copied() else {
240-
log::debug!("icon_img: icon {name} not found");
239+
let Some(&inner_content) = icons::ICON_MAP.get(name.as_str()) else {
240+
log::warn!("icon_img: icon {name} not found");
241241
return Ok(());
242242
};
243243

0 commit comments

Comments
 (0)