diff --git a/Shokofin/Utils/GuardedMemoryCache.cs b/Shokofin/Utils/GuardedMemoryCache.cs index b6d0035..93d4d56 100644 --- a/Shokofin/Utils/GuardedMemoryCache.cs +++ b/Shokofin/Utils/GuardedMemoryCache.cs @@ -80,6 +80,10 @@ public TItem GetOrCreate(object key, Action foundAction, Func GetOrCreateAsync(object key, Action foundAction, Func> createFactory, MemoryCacheEntryOptions? createOptions = null) @@ -122,6 +126,10 @@ public async Task GetOrCreateAsync(object key, Action found throw; } + catch (Exception ex) { + Logger.LogWarning(ex, "Got an unexpected exception for key: {Key}", key); + throw; + } } public TItem GetOrCreate(object key, Func createFactory, MemoryCacheEntryOptions? createOptions = null) @@ -159,6 +167,10 @@ public TItem GetOrCreate(object key, Func createFactory, MemoryCac throw; } + catch (Exception ex) { + Logger.LogWarning(ex, "Got an unexpected exception for key: {Key}", key); + throw; + } } public async Task GetOrCreateAsync(object key, Func> createFactory, MemoryCacheEntryOptions? createOptions = null) @@ -196,6 +208,10 @@ public async Task GetOrCreateAsync(object key, Func> c throw; } + catch (Exception ex) { + Logger.LogWarning(ex, "Got an unexpected exception for key: {Key}", key); + throw; + } } public void Dispose() @@ -218,4 +234,4 @@ public bool TryGetValue(object key, [NotNullWhen(true)] out TItem? value) public TItem? Set(object key, [NotNullIfNotNull(nameof(value))] TItem? value, MemoryCacheEntryOptions? createOptions = null) => Cache.Set(key, value, createOptions ?? CacheEntryOptions); -} \ No newline at end of file +}