Updated Syncer

Added more error catching when processing in sync data.
This commit is contained in:
Mario Steele 2025-07-31 07:38:26 -05:00
parent ad155026d1
commit 789ceeedff

View file

@ -164,9 +164,18 @@ public class Syncer<T> : ISyncer where T : class, IDataModel, new()
}
catch (Exception ex)
{
var jobj = JsonSerializer.Deserialize<JsonObject>(entryObject, GlobalJsonOptions.Options);
entry = new T();
entry.MarshalData(jobj["_id"].GetValue<string>(), entryObject);
try
{
var jobj = JsonSerializer.Deserialize<JsonObject>(entryObject, GlobalJsonOptions.Options);
entry = new T();
entry.MarshalData(jobj["_id"].GetValue<string>(), entryObject);
}
catch (Exception iex)
{
// TODO: Replace with Logger
Console.WriteLine($"Failed to parse line: {entryObject}\nMessage: {iex.Message}");
entry = null;
}
}
if (entry == null) return;