using System;
namespace Discord.Net
{
///
/// The exception that is thrown when the WebSocket session is closed by Discord.
///
public class WebSocketClosedException : Exception
{
///
/// Gets the close code sent by Discord.
///
///
/// A
/// close code
/// from Discord.
///
public int CloseCode { get; }
///
/// Gets the reason of the interruption.
///
public string Reason { get; }
///
/// Initializes a new instance of the using a Discord close code
/// and an optional reason.
///
public WebSocketClosedException(int closeCode, string reason = null)
: base($"The server sent close {closeCode}{(reason != null ? $": \"{reason}\"" : "")}")
{
CloseCode = closeCode;
Reason = reason;
}
}
}