aspnetcore/src/Microsoft.AspNet.JsonPatch/Exceptions/JsonPatchException.cs

42 lines
1.2 KiB
C#

// Copyright (c) Microsoft Open Technologies, Inc. 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.AspNet.JsonPatch.Operations;
namespace Microsoft.AspNet.JsonPatch.Exceptions
{
public class JsonPatchException<T> : JsonPatchException where T : class
{
public Operation<T> FailedOperation { get; private set; }
public new T AffectedObject { get; private set; }
private string _message = "";
public override string Message
{
get
{
return _message;
}
}
public JsonPatchException()
{
}
public JsonPatchException(JsonPatchError<T> jsonPatchError)
{
FailedOperation = jsonPatchError.Operation;
_message = jsonPatchError.ErrorMessage;
AffectedObject = jsonPatchError.AffectedObject;
}
public JsonPatchException(JsonPatchError<T> jsonPatchError, Exception innerException)
: this(jsonPatchError)
{
InnerException = innerException;
}
}
}