Add ex to catch if cached mediainfo doesnt exist

pull/10881/head
TelepathicWalrus 1 year ago
parent d40224128c
commit 08592fb3fe

@ -48,20 +48,25 @@ namespace Emby.Server.Implementations.Library
if (!string.IsNullOrEmpty(cacheKey)) if (!string.IsNullOrEmpty(cacheKey))
{ {
FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
try try
{ {
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false); FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
// _logger.LogDebug("Found cached media info"); try
} {
catch (Exception ex) mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
{ // _logger.LogDebug("Found cached media info");
_logger.LogError(ex, "Error deserializing mediainfo cache"); }
catch (Exception ex)
{
_logger.LogError(ex, "Error deserializing mediainfo cache");
}
await jsonStream.DisposeAsync().ConfigureAwait(false);
} }
finally catch
{ {
await jsonStream.DisposeAsync().ConfigureAwait(false); _logger.LogError("Could not open cached media info");
} }
} }

Loading…
Cancel
Save