Add the filename to the exception's trace to facilitate error resolution (see #12254, #9508, ...)

This commit is contained in:
Loïc CORBASSON
2026-02-16 17:05:27 +01:00
parent fc6419685c
commit 893188ab28

View File

@@ -85,9 +85,17 @@ namespace Emby.Server.Implementations.Serialization
/// <returns>System.Object.</returns>
public object? DeserializeFromFile(Type type, string file)
{
using (var stream = File.OpenRead(file))
try
{
return DeserializeFromStream(type, stream);
using (var stream = File.OpenRead(file))
{
return DeserializeFromStream(type, stream);
}
}
catch (Exception ex)
{
ex.Data.Add("Filename", file);
throw;
}
}