@@ -511,7 +511,7 @@ namespace Discord.WebSocket | |||||
case GatewayOpCode.Reconnect: | case GatewayOpCode.Reconnect: | ||||
{ | { | ||||
await _gatewayLogger.DebugAsync("Received Reconnect").ConfigureAwait(false); | await _gatewayLogger.DebugAsync("Received Reconnect").ConfigureAwait(false); | ||||
_connection.Error(new GatewayReconnectException()); | |||||
_connection.Error(new GatewayReconnectException("Server requested a reconnect")); | |||||
} | } | ||||
break; | break; | ||||
case GatewayOpCode.Dispatch: | case GatewayOpCode.Dispatch: | ||||
@@ -1689,7 +1689,7 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
if (ConnectionState == ConnectionState.Connected && (_guildDownloadTask?.IsCompleted ?? true)) | if (ConnectionState == ConnectionState.Connected && (_guildDownloadTask?.IsCompleted ?? true)) | ||||
{ | { | ||||
_connection.Error(new Exception("Server missed last heartbeat")); | |||||
_connection.Error(new GatewayReconnectException("Server missed last heartbeat")); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
@@ -3,7 +3,7 @@ using System; | |||||
namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// An exception thrown when Discord requests the gateway client to | |||||
/// An exception thrown when the gateway client has been requested to | |||||
/// reconnect. | /// reconnect. | ||||
/// </summary> | /// </summary> | ||||
public class GatewayReconnectException : Exception | public class GatewayReconnectException : Exception | ||||
@@ -12,8 +12,11 @@ namespace Discord.WebSocket | |||||
/// Creates a new instance of the | /// Creates a new instance of the | ||||
/// <see cref="GatewayReconnectException"/> type. | /// <see cref="GatewayReconnectException"/> type. | ||||
/// </summary> | /// </summary> | ||||
public GatewayReconnectException() | |||||
: base("Server requested a reconnect") | |||||
/// <param name="message"> | |||||
/// The reason why the gateway has been requested to reconnect. | |||||
/// </param> | |||||
public GatewayReconnectException(string message) | |||||
: base(message) | |||||
{ } | { } | ||||
} | } | ||||
} | } |