Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: include properly typed entity in exception, not only its json value #111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ChronoJsonDiffPatch/ChronoJsonDiffPatch/PatchingException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading