using System;
namespace EmbedIO
{
///
/// Represents an exception that results in a particular
/// HTTP response to be sent to the client.
/// This interface is meant to be implemented
/// by classes derived from .
/// Either as message or a data object can be attached to
/// the exception; which one, if any, is sent to the client
/// will depend upon the handler used to send the response.
///
///
///
public interface IHttpException
{
///
/// Gets the response status code for a HTTP exception.
///
int StatusCode { get; }
///
/// Gets the stack trace of a HTTP exception.
///
string StackTrace { get; }
///
/// Gets a message that can be included in the response triggered
/// by a HTTP exception.
/// Whether the message is actually sent to the client will depend
/// upon the handler used to send the response.
///
///
/// Do not rely on to implement
/// this property if you want to support messages,
/// because a default message will be supplied by the CLR at throw time
/// when is .
///
string? Message { get; }
///
/// Gets an object that can be serialized and included
/// in the response triggered by a HTTP exception.
/// Whether the object is actually sent to the client will depend
/// upon the handler used to send the response.
///
object? DataObject { get; }
///
/// Sets necessary headers, as required by the nature
/// of the HTTP exception (e.g. Location for
/// ).
///
/// The HTTP context of the response.
void PrepareResponse(IHttpContext context);
}
}