using System.Collections.Generic;
namespace LaunchDarkly.EventSource
{
///
/// Indicates that the EventSource was able to establish an HTTP connection, but received a
/// non-successful status code.
///
public class EventSourceServiceUnsuccessfulResponseException : EventSourceServiceCancelledException
{
#region Public Properties
///
/// The HTTP status code of the response.
///
public int StatusCode { get; }
///
/// The HTTP headers from the response.
///
public IEnumerable>> Headers { get; }
#endregion
#region Public Constructors
///
/// Creates a new instance.
///
/// the HTTP status code of the response
public EventSourceServiceUnsuccessfulResponseException(int statusCode) :
this(statusCode, new Dictionary>())
{
}
///
/// Creates a new instance with headers.
///
/// the HTTP status code of the response
/// the HTTP headers from the response
public EventSourceServiceUnsuccessfulResponseException(int statusCode, IEnumerable>> headers) :
base(string.Format(Resources.ErrorHttpStatus, statusCode))
{
StatusCode = statusCode;
Headers = headers ?? new Dictionary>();
}
#endregion
}
}