throw less-generic exception if icon lookup failed

This commit is contained in:
goat 2024-06-29 19:06:23 +02:00
parent 085d76afda
commit ad1a19000f
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,17 @@
namespace Dalamud.Interface.Textures.Internal;
/// <summary>
/// Exception thrown when an icon could not be found.
/// </summary>
public class IconNotFoundException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="IconNotFoundException"/> class.
/// </summary>
/// <param name="lookup">The lookup that was used to find the icon.</param>
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.")
{
}
}

View file

@ -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)
{