From d9f279007ac9b4268be66b48240637a1973c5003 Mon Sep 17 00:00:00 2001 From: Konstantin <konstantin.klein+github@hochfrequenz.de> Date: Tue, 21 Jan 2025 15:41:05 +0100 Subject: [PATCH] chore: include entity in exception, not only it's json value --- ChronoJsonDiffPatch/ChronoJsonDiffPatch/PatchingException.cs | 4 ++-- .../ChronoJsonDiffPatch/TimeRangePatchChain.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ChronoJsonDiffPatch/ChronoJsonDiffPatch/PatchingException.cs b/ChronoJsonDiffPatch/ChronoJsonDiffPatch/PatchingException.cs index 063dac7..991a715 100644 --- a/ChronoJsonDiffPatch/ChronoJsonDiffPatch/PatchingException.cs +++ b/ChronoJsonDiffPatch/ChronoJsonDiffPatch/PatchingException.cs @@ -18,7 +18,7 @@ public class PatchingException<TEntity> : Exception /// <summary> /// state of the entity at the point where Applying <see cref="FailedPatch"/> failed /// </summary> - public JToken StateOfEntityBeforePatch { get; } + public TEntity StateOfEntityBeforePatch { get; } /// <summary> /// patch that could not be applied @@ -41,7 +41,7 @@ public class PatchingException<TEntity> : Exception /// <param name="innerException"></param> public PatchingException( TEntity stateOfEntityBeforeAnyPatch, - JToken left, + TEntity left, JToken? patch, int index, string message, diff --git a/ChronoJsonDiffPatch/ChronoJsonDiffPatch/TimeRangePatchChain.cs b/ChronoJsonDiffPatch/ChronoJsonDiffPatch/TimeRangePatchChain.cs index 89404bd..736291b 100644 --- a/ChronoJsonDiffPatch/ChronoJsonDiffPatch/TimeRangePatchChain.cs +++ b/ChronoJsonDiffPatch/ChronoJsonDiffPatch/TimeRangePatchChain.cs @@ -599,7 +599,7 @@ var existingPatch in GetAll() throw new PatchingException<TEntity>( stateOfEntityBeforeAnyPatch: initialEntity, - left: left, + left: entityBeforePatch, patch: jtokenPatch, index: index, message: $"Failed to apply patches ({PatchingDirection}): {exc.Message}; None of the {_skipConditions?.Count() ?? 0} skip conditions applied", @@ -645,7 +645,7 @@ var existingPatch in GetAll() throw new PatchingException<TEntity>( stateOfEntityBeforeAnyPatch: initialEntity, - left: left, + left: entityBeforePatch, patch: jtokenPatch, index: index, message: $"Failed to apply patches ({PatchingDirection}): {exc.Message}; None of the {_skipConditions?.Count() ?? 0} skip conditions applied",