mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
throw less-generic exception if icon lookup failed
This commit is contained in:
parent
085d76afda
commit
ad1a19000f
2 changed files with 18 additions and 1 deletions
17
Dalamud/Interface/Textures/Internal/IconNotFoundException.cs
Normal file
17
Dalamud/Interface/Textures/Internal/IconNotFoundException.cs
Normal 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.")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue