handle non-existent icons
Some checks failed
Django CI/CD / test (push) Successful in 58s
Django CI/CD / build-and-push (push) Has been cancelled

This commit is contained in:
Lukáš Kucharczyk 2024-11-09 21:28:52 +00:00
parent cf503a7b7d
commit 8fc65f467c

View File

@ -128,7 +128,11 @@ def Icon(
name: str,
attributes: list[HTMLAttribute] = [],
):
return Component(template=f"cotton/icon/{name}.html", attributes=attributes)
try:
result = Component(template=f"cotton/icon/{name}.html", attributes=attributes)
except TemplateDoesNotExist:
result = Icon(name="unspecified", attributes=attributes)
return result
def LinkedNameWithPlatformIcon(name: str, game_id: int, platform: str) -> SafeText: