diff --git a/docs/SerializationErrorHandling.md b/docs/SerializationErrorHandling.md index b5ef62d6..e1aa9a9c 100644 --- a/docs/SerializationErrorHandling.md +++ b/docs/SerializationErrorHandling.md @@ -29,7 +29,7 @@ var c = JsonConvert.DeserializeObject>( """, new JsonSerializerSettings { - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -61,7 +61,7 @@ var errors = new List(); var serializer = new JsonSerializer { - SerializeError = (currentObject, originalObject, location, exception, markAsHandled) => + SerializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { // only log an error once if (currentObject == originalObject) @@ -69,7 +69,7 @@ var serializer = new JsonSerializer errors.Add(exception.Message); } }, - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { // only log an error once if (currentObject == originalObject) @@ -115,7 +115,7 @@ public class PersonError : public string Title { get; set; } - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } ``` diff --git a/docs/Serializer/ErrorHandlingAttribute.md b/docs/Serializer/ErrorHandlingAttribute.md index c891a9d5..4c1a7f11 100644 --- a/docs/Serializer/ErrorHandlingAttribute.md +++ b/docs/Serializer/ErrorHandlingAttribute.md @@ -30,7 +30,7 @@ public class Employee : public string Title { get; set; } - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } ``` diff --git a/docs/Serializer/ErrorHandlingEvent.md b/docs/Serializer/ErrorHandlingEvent.md index 9d8effc9..abfeef2a 100644 --- a/docs/Serializer/ErrorHandlingEvent.md +++ b/docs/Serializer/ErrorHandlingEvent.md @@ -22,7 +22,7 @@ var c = JsonConvert.DeserializeObject>( """, new JsonSerializerSettings { - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); diff --git a/src/Argon.InterfaceCallbacks/IJsonOnDeserializeError.cs b/src/Argon.InterfaceCallbacks/IJsonOnDeserializeError.cs index f387cce7..96e4eaf5 100644 --- a/src/Argon.InterfaceCallbacks/IJsonOnDeserializeError.cs +++ b/src/Argon.InterfaceCallbacks/IJsonOnDeserializeError.cs @@ -5,5 +5,5 @@ namespace Argon; /// public interface IJsonOnDeserializeError { - void OnDeserializeError(object? originalObject, ErrorLocation location, Exception exception, Action markAsHanded); + void OnDeserializeError(object? originalObject, string path, object? member, Exception exception, Action markAsHanded); } \ No newline at end of file diff --git a/src/Argon.InterfaceCallbacks/IJsonOnSerializeError.cs b/src/Argon.InterfaceCallbacks/IJsonOnSerializeError.cs index c0c4b137..dab8c77c 100644 --- a/src/Argon.InterfaceCallbacks/IJsonOnSerializeError.cs +++ b/src/Argon.InterfaceCallbacks/IJsonOnSerializeError.cs @@ -8,5 +8,5 @@ public interface IJsonOnSerializeError /// /// The method that is called on serialization error. /// - void OnSerializeError(object? originalObject, ErrorLocation location, Exception exception, Action markAsHanded); + void OnSerializeError(object? originalObject, string path, object? member, Exception exception, Action markAsHanded); } \ No newline at end of file diff --git a/src/Argon.InterfaceCallbacks/InterfaceCallbacks.cs b/src/Argon.InterfaceCallbacks/InterfaceCallbacks.cs index 4443123e..412eb127 100644 --- a/src/Argon.InterfaceCallbacks/InterfaceCallbacks.cs +++ b/src/Argon.InterfaceCallbacks/InterfaceCallbacks.cs @@ -4,18 +4,18 @@ public static class InterfaceCallbacks { public static void AddInterfaceCallbacks(this JsonSerializerSettings settings) { - settings.SerializeError += (currentObject, originalObject, location, exception, handled) => + settings.SerializeError += (currentObject, originalObject, path, member, exception, handled) => { if (currentObject is IJsonOnSerializeError onError) { - onError.OnSerializeError(originalObject, location, exception, handled); + onError.OnSerializeError(originalObject, path, member, exception, handled); } }; - settings.DeserializeError += (currentObject, originalObject, location, exception, handled) => + settings.DeserializeError += (currentObject, originalObject, path, member, exception, handled) => { if (currentObject is IJsonOnDeserializeError onError) { - onError.OnDeserializeError(originalObject, location, exception, handled); + onError.OnDeserializeError(originalObject, path, member, exception, handled); } }; settings.Serializing += (_, target) => diff --git a/src/Argon/Callbacks/ErrorLocation.cs b/src/Argon/Callbacks/ErrorLocation.cs deleted file mode 100644 index f0f773d7..00000000 --- a/src/Argon/Callbacks/ErrorLocation.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Argon; - -public readonly record struct ErrorLocation(string Path, object? Member) -{ - public override string ToString() - { - if (Member == null) - { - return Path; - } - - return $"{Path} - {Member}"; - } -} \ No newline at end of file diff --git a/src/Argon/Callbacks/OnDeserializeError.cs b/src/Argon/Callbacks/OnDeserializeError.cs index dfae7a17..6fde274f 100644 --- a/src/Argon/Callbacks/OnDeserializeError.cs +++ b/src/Argon/Callbacks/OnDeserializeError.cs @@ -3,4 +3,4 @@ /// /// Handles deserialization error callback events. /// -public delegate void OnDeserializeError(object? currentObject, object? originalObject, ErrorLocation location, Exception exception, Action markAsHandled); \ No newline at end of file +public delegate void OnDeserializeError(object? currentObject, object? originalObject, string path, object? member, Exception exception, Action markAsHandled); \ No newline at end of file diff --git a/src/Argon/Callbacks/OnSerializeError.cs b/src/Argon/Callbacks/OnSerializeError.cs index 46b65e99..5463501b 100644 --- a/src/Argon/Callbacks/OnSerializeError.cs +++ b/src/Argon/Callbacks/OnSerializeError.cs @@ -3,4 +3,4 @@ /// /// Handles serialization error callback events. /// -public delegate void OnSerializeError(object? currentObject, object? originalObject, ErrorLocation location, Exception exception, Action markAsHandled); \ No newline at end of file +public delegate void OnSerializeError(object? currentObject, object? originalObject, string path, object? member, Exception exception, Action markAsHandled); \ No newline at end of file diff --git a/src/Argon/Serialization/JsonSerializerInternalReader.cs b/src/Argon/Serialization/JsonSerializerInternalReader.cs index 846c51c3..eb67d937 100644 --- a/src/Argon/Serialization/JsonSerializerInternalReader.cs +++ b/src/Argon/Serialization/JsonSerializerInternalReader.cs @@ -2249,7 +2249,8 @@ protected bool IsDeserializeErrorHandled(object? currentObject, object? member, .Invoke( currentObject, currentDeserializeErrorContext.OriginalObject, - new(path, member), + path, + member, exception, () => currentDeserializeErrorContext.Handled = true); } diff --git a/src/Argon/Serialization/JsonSerializerInternalWriter.cs b/src/Argon/Serialization/JsonSerializerInternalWriter.cs index f62ecaa5..5b6e5f4e 100644 --- a/src/Argon/Serialization/JsonSerializerInternalWriter.cs +++ b/src/Argon/Serialization/JsonSerializerInternalWriter.cs @@ -1098,7 +1098,8 @@ protected bool IsSerializeErrorHandled(object? currentObject, object? member, st .Invoke( currentObject, currentSerializeErrorContext.OriginalObject, - new(path, member), + path, + member, exception, () => currentSerializeErrorContext.Handled = true); } diff --git a/src/ArgonTests/Converters/DataTableConverterTests.cs b/src/ArgonTests/Converters/DataTableConverterTests.cs index 2490fb06..4273b24d 100644 --- a/src/ArgonTests/Converters/DataTableConverterTests.cs +++ b/src/ArgonTests/Converters/DataTableConverterTests.cs @@ -711,7 +711,7 @@ public override object ReadJson(JsonReader reader, Type type, object existingVal existingValue ??= CreateTable(); var previousError = serializer.DeserializeError; - serializer.DeserializeError = (_, _, _, _, markAsHandled) => markAsHandled(); + serializer.DeserializeError = (_, _, _, _, _, markAsHandled) => markAsHandled(); try { return base.ReadJson(reader, type, existingValue, serializer); @@ -722,7 +722,7 @@ public override object ReadJson(JsonReader reader, Type type, object existingVal } } - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } } \ No newline at end of file diff --git a/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingAttribute.cs b/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingAttribute.cs index 1d24c288..25a2b5c2 100644 --- a/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingAttribute.cs +++ b/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingAttribute.cs @@ -30,7 +30,7 @@ public List Roles public string Title { get; set; } - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } diff --git a/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingEvent.cs b/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingEvent.cs index 5e83c150..c4fcb320 100644 --- a/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingEvent.cs +++ b/src/ArgonTests/Documentation/Samples/Serializer/ErrorHandlingEvent.cs @@ -28,7 +28,7 @@ public void Example() """, new JsonSerializerSettings { - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); diff --git a/src/ArgonTests/Documentation/SerializationTests.cs b/src/ArgonTests/Documentation/SerializationTests.cs index 9daf6e7c..0c9a81ef 100644 --- a/src/ArgonTests/Documentation/SerializationTests.cs +++ b/src/ArgonTests/Documentation/SerializationTests.cs @@ -200,7 +200,7 @@ public void SerializationErrorHandling() """, new JsonSerializerSettings { - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -248,7 +248,7 @@ public void SerializationErrorHandlingWithParent() var serializer = new JsonSerializer { - SerializeError = (currentObject, originalObject, location, exception, markAsHandled) => + SerializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { // only log an error once if (currentObject == originalObject) @@ -256,7 +256,7 @@ public void SerializationErrorHandlingWithParent() errors.Add(exception.Message); } }, - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { // only log an error once if (currentObject == originalObject) @@ -295,7 +295,7 @@ public List Roles public string Title { get; set; } - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } diff --git a/src/ArgonTests/Serialization/JsonSerializerTest.cs b/src/ArgonTests/Serialization/JsonSerializerTest.cs index 7b6d59ba..2c23c1d4 100644 --- a/src/ArgonTests/Serialization/JsonSerializerTest.cs +++ b/src/ArgonTests/Serialization/JsonSerializerTest.cs @@ -632,7 +632,7 @@ public void ReadIntegerWithError() json, new JsonSerializerSettings { - DeserializeError = (_, _, _, _, markAsHandled) => markAsHandled() + DeserializeError = (_, _, _, _, _, markAsHandled) => markAsHandled() }); Assert.Equal(0, l.ChildId); @@ -5832,7 +5832,7 @@ public void ObjectRequiredDeserializeMissing() json, new JsonSerializerSettings { - DeserializeError = (_, _, _, exception, markAsHandled) => + DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -5857,7 +5857,7 @@ public void ObjectRequiredDeserializeNull() json, new JsonSerializerSettings { - DeserializeError = (_, _, _, exception, markAsHandled) => + DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -5880,7 +5880,7 @@ public void ObjectRequiredSerialize() new RequiredObject(), new JsonSerializerSettings { - SerializeError = (_, _, _, exception, markAsHandled) => + SerializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); diff --git a/src/ArgonTests/Serialization/SerializationErrorHandlingTests.cs b/src/ArgonTests/Serialization/SerializationErrorHandlingTests.cs index c20bccf5..bd61d9ef 100644 --- a/src/ArgonTests/Serialization/SerializationErrorHandlingTests.cs +++ b/src/ArgonTests/Serialization/SerializationErrorHandlingTests.cs @@ -18,7 +18,7 @@ public void ErrorHandlingMetadata() new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto, - DeserializeError = (_, _, _, exception, markAsHandled) => + DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception); markAsHandled(); @@ -40,7 +40,7 @@ public void ErrorHandlingMetadata_TopLevel() new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto, - DeserializeError = (_, _, _, exception, markAsHandled) => + DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception); markAsHandled(); @@ -79,7 +79,7 @@ public void ErrorDeserializingIntegerInObject() json, new JsonSerializerSettings { - DeserializeError = (_, _, _, exception, markAsHandled) => + DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -220,7 +220,7 @@ public void SerializingErrorIn3DArray() new JsonSerializerSettings { Formatting = Formatting.Indented, - SerializeError = (currentObject, _, _, _, markAsHandled) => + SerializeError = (currentObject, _, _, _, _, markAsHandled) => { if (currentObject.GetType().IsArray) { @@ -352,9 +352,9 @@ public void DeserializingErrorHandlingUsingEvent() var serializer = JsonSerializer.Create( new() { - DeserializeError = (_, _, location, exception, markAsHanded) => + DeserializeError = (_, _, path, member, exception, markAsHanded) => { - errors.Add($"{location} - {exception.Message}"); + errors.Add($"{path} - {member} - {exception.Message}"); markAsHanded(); }, Converters = @@ -417,7 +417,7 @@ public void DeserializingErrorInDateTimeCollectionWithAttributeWithEventNotCalle var settings = new JsonSerializerSettings { - DeserializeError = (_, _, _, _, handled) => + DeserializeError = (_, _, _, _, _, handled) => { eventErrorHandlerCalled = true; handled(); @@ -488,12 +488,12 @@ public Task DeserializeNestedUnhandled() { var serializer = new JsonSerializer { - DeserializeError = (currentObject, originalObject, location, exception, _) => + DeserializeError = (currentObject, originalObject, path, member, exception, _) => { // only log an error once if (currentObject == originalObject) { - errors.Add($"{location} - {exception.Message}"); + errors.Add($"{path} - {member} - {exception.Message}"); } } }; @@ -522,9 +522,9 @@ public void MultipleRequiredPropertyErrors() var serializer = new JsonSerializer { MetadataPropertyHandling = MetadataPropertyHandling.Default, - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { - errors.Add($"{location} - {exception.Message}"); + errors.Add($"{path} - {member} - {exception.Message}"); markAsHandled(); } }; @@ -544,9 +544,9 @@ public void HandlingArrayErrors() var serializer = new JsonSerializer { - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { - errors.Add($"{location} - {exception.Message}"); + errors.Add($"{path} - {member} - {exception.Message}"); markAsHandled(); } }; @@ -567,9 +567,9 @@ public void HandlingMultidimensionalArrayErrors() var serializer = new JsonSerializer { - DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { - errors.Add($"{location} - {exception.Message}"); + errors.Add($"{path} - {member} - {exception.Message}"); markAsHandled(); } }; @@ -587,10 +587,10 @@ public void ErrorHandlingAndAvoidingRecursiveDepthError() var json = "{'A':{'A':{'A':{'A':{'A':{}}}}}}"; var serializer = new JsonSerializer(); var errors = new List(); - serializer.DeserializeError = (currentObject, originalObject, location, exception, markAsHandled) => + serializer.DeserializeError = (currentObject, originalObject, path, member, exception, markAsHandled) => { markAsHandled(); - errors.Add(location.Path); + errors.Add(path); }; serializer.Deserialize(new JsonTextReader(new StringReader(json)) @@ -614,7 +614,7 @@ public void InfiniteErrorHandlingLoopFromInputError() var serializer = new JsonSerializer { - DeserializeError = (_, _, _, exception, markAsHandled) => + DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -640,7 +640,7 @@ public void ArrayHandling() typeof(int[]), new JsonSerializerSettings { - DeserializeError = (_, _, _, exception, markAsHanded) => + DeserializeError = (_, _, _, _, exception, markAsHanded) => { errors.Add(exception.Message); markAsHanded(); @@ -665,7 +665,7 @@ public void ArrayHandling_JTokenReader() var serializer = JsonSerializer.Create(new() { - DeserializeError = (_, _, _, exception, markAsHanded) => + DeserializeError = (_, _, _, _, exception, markAsHanded) => { errors.Add(exception.Message); markAsHanded(); @@ -692,7 +692,7 @@ public void ArrayHandlingInObject() new JsonSerializerSettings { MetadataPropertyHandling = MetadataPropertyHandling.Default, - DeserializeError = (_, _, _, exception, markAsHanded) => + DeserializeError = (_, _, _, _, exception, markAsHanded) => { errors.Add(exception.Message); markAsHanded(); @@ -729,7 +729,7 @@ public void ErrorHandlingEndOfContent() MaxDepth = maxDepth, MetadataPropertyHandling = MetadataPropertyHandling.Default }); - serializer.DeserializeError = (_, _, _, exception, markAsHandled) => + serializer.DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -766,7 +766,7 @@ public void ErrorHandlingEndOfContentDictionary() MaxDepth = maxDepth, MetadataPropertyHandling = MetadataPropertyHandling.Default }); - serializer.DeserializeError = (_, _, _, exception, markAsHandled) => + serializer.DeserializeError = (_, _, _, _, exception, markAsHandled) => { errors.Add(exception.Message); markAsHandled(); @@ -803,7 +803,7 @@ public void ErrorHandlingEndOfContentDynamic() json, new JsonSerializerSettings { - DeserializeError = (_, _, _, exception, markAsHanded) => + DeserializeError = (_, _, _, _, exception, markAsHanded) => { errors.Add(exception.Message); markAsHanded(); @@ -827,7 +827,7 @@ public void ErrorHandlingEndOfContentDynamic() public void WriteEndOnPropertyState() { var settings = new JsonSerializerSettings(); - settings.SerializeError += (_, _, _, _, markAsHanded) => markAsHanded(); + settings.SerializeError += (_, _, _, _, _, markAsHanded) => markAsHanded(); var data = new List { @@ -859,7 +859,7 @@ public void WriteEndOnPropertyState2() { var settings = new JsonSerializerSettings { - SerializeError = (_, _, _, _, markAsHanded) => markAsHanded() + SerializeError = (_, _, _, _, _, markAsHanded) => markAsHanded() }; var data = new List @@ -903,7 +903,7 @@ public void NoObjectWithEvent() var jReader = new JsonTextReader(new StreamReader(stream)); var s = new JsonSerializer { - DeserializeError = (_, _, _, _, markAsHandled) => + DeserializeError = (_, _, _, _, _, markAsHandled) => { markAsHandled(); } @@ -1045,7 +1045,7 @@ public void DeserializeRootConverter() var result = JsonConvert.TryDeserializeObject("{}", new JsonSerializerSettings { - DeserializeError = (_, _, _, _, markAsHanded) => + DeserializeError = (_, _, _, _, _, markAsHanded) => { markAsHanded(); } @@ -1061,7 +1061,7 @@ public void SerializeRootConverter() new SomethingElse(), new JsonSerializerSettings { - SerializeError = (_, _, _, _, markAsHanded) => markAsHanded() + SerializeError = (_, _, _, _, _, markAsHanded) => markAsHanded() }); Assert.Equal(string.Empty, result); @@ -1184,7 +1184,7 @@ public class LogEvent public class ErrorTestObject : IJsonOnDeserializeError { - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHanded) + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHanded) { } } @@ -1196,7 +1196,7 @@ public class TolerantDictionary : Dictionary, IJsonOnDeserializeError { - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } } \ No newline at end of file diff --git a/src/ArgonTests/Serialization/SerializationEventTests.cs b/src/ArgonTests/Serialization/SerializationEventTests.cs index 9fa8d524..2e5dd595 100644 --- a/src/ArgonTests/Serialization/SerializationEventTests.cs +++ b/src/ArgonTests/Serialization/SerializationEventTests.cs @@ -287,7 +287,7 @@ public class FooEvent: { public int Identifier { get; set; } - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) { Identifier = 25; diff --git a/src/ArgonTests/TestObjects/DateTimeErrorObjectCollection.cs b/src/ArgonTests/TestObjects/DateTimeErrorObjectCollection.cs index 9840e8b8..aaaf220a 100644 --- a/src/ArgonTests/TestObjects/DateTimeErrorObjectCollection.cs +++ b/src/ArgonTests/TestObjects/DateTimeErrorObjectCollection.cs @@ -10,6 +10,6 @@ public class DateTimeErrorObjectCollection : Collection, IJsonOnDeserializeError { - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } \ No newline at end of file diff --git a/src/ArgonTests/TestObjects/ListErrorObjectCollection.cs b/src/ArgonTests/TestObjects/ListErrorObjectCollection.cs index 838ffab4..a597c6d7 100644 --- a/src/ArgonTests/TestObjects/ListErrorObjectCollection.cs +++ b/src/ArgonTests/TestObjects/ListErrorObjectCollection.cs @@ -11,9 +11,9 @@ public class ListErrorObjectCollection : IJsonOnSerializeError, IJsonOnDeserializeError { - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } \ No newline at end of file diff --git a/src/ArgonTests/TestObjects/PersonError.cs b/src/ArgonTests/TestObjects/PersonError.cs index 4179517b..bc08c63c 100644 --- a/src/ArgonTests/TestObjects/PersonError.cs +++ b/src/ArgonTests/TestObjects/PersonError.cs @@ -28,6 +28,6 @@ public List Roles public string Title { get; set; } - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) => + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) => markAsHandled(); } \ No newline at end of file diff --git a/src/ArgonTests/TestObjects/SerializationEventTestObject.cs b/src/ArgonTests/TestObjects/SerializationEventTestObject.cs index 464e2764..48048676 100644 --- a/src/ArgonTests/TestObjects/SerializationEventTestObject.cs +++ b/src/ArgonTests/TestObjects/SerializationEventTestObject.cs @@ -58,15 +58,15 @@ public void OnDeserializing() => public virtual void OnDeserialized() => Member4 = "This value was set after deserialization."; - public void OnSerializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) + public void OnSerializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) { - Member5 = $"Error message for member {location.Member} = {exception.Message}"; + Member5 = $"Error message for member {member} = {exception.Message}"; markAsHandled(); } - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) { - Member5 = $"Error message for member {location.Member} = {exception.Message}"; + Member5 = $"Error message for member {member} = {exception.Message}"; markAsHandled(); } } \ No newline at end of file diff --git a/src/ArgonTests/TestObjects/VersionKeyedCollection.cs b/src/ArgonTests/TestObjects/VersionKeyedCollection.cs index e96ea891..4567e170 100644 --- a/src/ArgonTests/TestObjects/VersionKeyedCollection.cs +++ b/src/ArgonTests/TestObjects/VersionKeyedCollection.cs @@ -16,9 +16,9 @@ public class VersionKeyedCollection : protected override string GetKeyForItem(Person item) => item.Name; - public void OnDeserializeError(object originalObject, ErrorLocation location, Exception exception, Action markAsHandled) + public void OnDeserializeError(object originalObject, string path, object member, Exception exception, Action markAsHandled) { - Messages.Add($"{location.Path} - Error message for member {location.Member} = {exception.Message}"); + Messages.Add($"{path} - Error message for member {member} = {exception.Message}"); markAsHandled(); }