using System;
using System.Net;
namespace OSHttpServer.Exceptions
{
///
/// All HTTP based exceptions will derive this class.
///
public class HttpException : Exception
{
private readonly HttpStatusCode _code;
///
/// Create a new HttpException
///
/// http status code (sent in the response)
/// error description
public HttpException(HttpStatusCode code, string message) : base(code + ": " + message)
{
_code = code;
}
///
/// Create a new HttpException
///
/// http status code (sent in the response)
/// error description
/// inner exception
public HttpException(HttpStatusCode code, string message, Exception inner)
: base(code + ": " + message, inner)
{
_code = code;
}
///
/// status code to use in the response.
///
public HttpStatusCode HttpStatusCode
{
get { return _code; }
}
}
}