diff --git a/Dalamud/Interface/Textures/Internal/IconNotFoundException.cs b/Dalamud/Interface/Textures/Internal/IconNotFoundException.cs new file mode 100644 index 000000000..aa098ff45 --- /dev/null +++ b/Dalamud/Interface/Textures/Internal/IconNotFoundException.cs @@ -0,0 +1,17 @@ +namespace Dalamud.Interface.Textures.Internal; + +/// +/// Exception thrown when an icon could not be found. +/// +public class IconNotFoundException : Exception +{ + /// + /// Initializes a new instance of the class. + /// + /// The lookup that was used to find the icon. + internal IconNotFoundException(GameIconLookup lookup) + : base($"The icon with the ID {lookup.IconId} {(lookup.HiRes ? "HiRes" : string.Empty)} {(lookup.ItemHq ? "ItemHq" : string.Empty)} " + + $"with language {lookup.Language} was not found.") + { + } +} diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs b/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs index dc0cb0f0f..d6c2fb346 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs @@ -137,7 +137,7 @@ internal sealed partial class TextureManager [MethodImpl(MethodImplOptions.AggressiveInlining)] private string GetIconPathByValue(GameIconLookup lookup) => - this.textureManager.TryGetIconPath(lookup, out var path) ? path : throw new FileNotFoundException(); + this.textureManager.TryGetIconPath(lookup, out var path) ? path : throw new IconNotFoundException(lookup); private void FrameworkOnUpdate(IFramework unused) {