// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.JsonPatch.Operations;
namespace Microsoft.AspNetCore.JsonPatch
{
///
/// Captures error message and the related entity and the operation that caused it.
///
public class JsonPatchError
{
///
/// Initializes a new instance of .
///
/// The object that is affected by the error.
/// The that caused the error.
/// The error message.
public JsonPatchError(
object affectedObject,
Operation operation,
string errorMessage)
{
if (errorMessage == null)
{
throw new ArgumentNullException(nameof(errorMessage));
}
AffectedObject = affectedObject;
Operation = operation;
ErrorMessage = errorMessage;
}
///
/// Gets the object that is affected by the error.
///
public object AffectedObject { get; }
///
/// Gets the that caused the error.
///
public Operation Operation { get; }
///
/// Gets the error message.
///
public string ErrorMessage { get; }
}
}