mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-08-07 04:42:17 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87f13ff8ed | ||
|
|
1e24df626a |
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>6.6.7.1</Version>
|
<Version>6.6.8.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ namespace FileManager
|
|||||||
{
|
{
|
||||||
var msg = "Unrecoverable error. Settings file cannot be found";
|
var msg = "Unrecoverable error. Settings file cannot be found";
|
||||||
var ex = new FileNotFoundException(msg, Filepath);
|
var ex = new FileNotFoundException(msg, Filepath);
|
||||||
Serilog.Log.Logger.Error(msg, ex);
|
Serilog.Log.Logger.Error(ex, msg);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ namespace FileManager
|
|||||||
{
|
{
|
||||||
var msg = "Unrecoverable error. Unable to read settings from Settings file";
|
var msg = "Unrecoverable error. Unable to read settings from Settings file";
|
||||||
var ex = new NullReferenceException(msg);
|
var ex = new NullReferenceException(msg);
|
||||||
Serilog.Log.Logger.Error(msg, ex);
|
Serilog.Log.Logger.Error(ex, msg);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,18 @@ namespace LibationFileManager
|
|||||||
if (File.Exists(jsonFile))
|
if (File.Exists(jsonFile))
|
||||||
{
|
{
|
||||||
var list = JsonConvert.DeserializeObject<List<CacheEntry>>(File.ReadAllText(jsonFile));
|
var list = JsonConvert.DeserializeObject<List<CacheEntry>>(File.ReadAllText(jsonFile));
|
||||||
|
|
||||||
|
// file exists but deser is null. this will never happen when file is healthy
|
||||||
|
if (list is null)
|
||||||
|
{
|
||||||
|
lock (locker)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Error("Error deserializing file. Wrong format. Possibly corrupt. Deleting file. {@DebugInfo}", new { jsonFile });
|
||||||
|
File.Delete(jsonFile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cache = new Cache<CacheEntry>(list);
|
cache = new Cache<CacheEntry>(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user