You've already forked linux-packaging-mono
39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Net.Http;
|
|
using System.Web.Http.Properties;
|
|
|
|
namespace System.Web.Http
|
|
{
|
|
/// <summary>
|
|
/// An exception that allows for a given <see cref="HttpResponseMessage"/>
|
|
/// to be returned to the client.
|
|
/// </summary>
|
|
[SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable", Justification = "This type is not meant to be serialized")]
|
|
[SuppressMessage("Microsoft.Usage", "CA2240:Implement ISerializable correctly", Justification = "This type has no serializable state")]
|
|
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "HttpResponseException is not a real exception and is just an easy way to return HttpResponseMessage")]
|
|
public class HttpResponseException : Exception
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="HttpResponseException"/> class.
|
|
/// </summary>
|
|
/// <param name="response">The response message.</param>
|
|
public HttpResponseException(HttpResponseMessage response)
|
|
: base(SRResources.HttpResponseExceptionMessage)
|
|
{
|
|
if (response == null)
|
|
{
|
|
throw Error.ArgumentNull("response");
|
|
}
|
|
|
|
Response = response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="HttpResponseMessage"/> to return to the client.
|
|
/// </summary>
|
|
public HttpResponseMessage Response { get; private set; }
|
|
}
|
|
}
|