public JsonPatchException(JsonPatchError jsonPatchError, Exception innerException, int suggestedStatusCode) : base(jsonPatchError.ErrorMessage, innerException) { FailedOperation = jsonPatchError.Operation; AffectedObject = jsonPatchError.AffectedObject; SuggestedStatusCode = suggestedStatusCode; }
public JsonPatchException(JsonPatchError jsonPatchError, Exception innerException, int suggestedStatusCode) : base(jsonPatchError.ErrorMessage, innerException) { FailedOperation = jsonPatchError.Operation; AffectedObject = jsonPatchError.AffectedObject; SuggestedStatusCode = suggestedStatusCode; }
/// <summary> /// Updates the model state with errors that were given by the patch operation. /// </summary> /// <param name="error">The error returned by the patch operation.</param> /// <param name="modelState">The model stat where validation issues can be added and tracked by property.</param> /// <param name="prefix">Prefix to use for the property name in the model state.</param> private static void ApplyErrorToModelState(JsonPatchError error, ModelStateDictionary modelState, string prefix) { var name = error.AffectedObject.GetType().Name; modelState.TryAddModelError ( string.IsNullOrEmpty(prefix) ? name : $"{prefix}.{name}", $"Op: {error.Operation.OperationType}, Path: {error.Operation.path}, Value: {error.Operation.value}, Error: {error.ErrorMessage}" ); }
private void LogError(JsonPatchError jsonPatchError) { if (LogErrorAction != null) { LogErrorAction(jsonPatchError); } else { throw new JsonPatchException(jsonPatchError); } }
public void LogErrorMessage(JsonPatchError patchError) { ErrorMessage = patchError.ErrorMessage; }
public JsonPatchException(JsonPatchError jsonPatchError) : this(jsonPatchError, null) { }
public JsonPatchException(JsonPatchError jsonPatchError, Exception innerException) : base(jsonPatchError.ErrorMessage, innerException) { FailedOperation = jsonPatchError.Operation; AffectedObject = jsonPatchError.AffectedObject; }
private void LogError(JsonPatchError jsonPatchError) { if (LogErrorAction != null) { LogErrorAction(jsonPatchError); } else { throw new JsonPatchException(jsonPatchError); } }
public JsonPatchException(JsonPatchError jsonPatchError, int suggestedStatusCode) : this(jsonPatchError, null, suggestedStatusCode) { }
public JsonPatchException(JsonPatchError jsonPatchError, int suggestedStatusCode) : this(jsonPatchError, null, suggestedStatusCode) { }
public JsonPatchException(JsonPatchError jsonPatchError) : this(jsonPatchError, null) { }
public JsonPatchException(JsonPatchError jsonPatchError, Exception innerException) : base(jsonPatchError.ErrorMessage, innerException) { FailedOperation = jsonPatchError.Operation; AffectedObject = jsonPatchError.AffectedObject; }
public JsonPatchException(JsonPatchError <TModel> jsonPatchError, Exception innerException) : this(jsonPatchError) { InnerException = innerException; }
public JsonPatchException(JsonPatchError <TModel> jsonPatchError) { FailedOperation = jsonPatchError.Operation; _message = jsonPatchError.ErrorMessage; AffectedObject = jsonPatchError.AffectedObject; }