// 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.Net; using System.Net.Http; using ShimResources = Microsoft.AspNetCore.Mvc.WebApiCompatShim.Resources; namespace System.Web.Http { public class HttpResponseException : Exception { /// /// Initializes a new instance of the class. /// /// The status code of the response. public HttpResponseException(HttpStatusCode statusCode) : this(new HttpResponseMessage(statusCode)) { } /// /// Initializes a new instance of the class. /// /// The response message. public HttpResponseException(HttpResponseMessage response) : base(ShimResources.HttpResponseExceptionMessage) { if (response == null) { throw new ArgumentNullException(nameof(response)); } Response = response; } /// /// Gets the to return to the client. /// public HttpResponseMessage Response { get; private set; } } }