Browse Source

Added a few null checks

tags/docs-0.9
RogueException 9 years ago
parent
commit
90e8d5994d
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/Discord.Net/DiscordSimpleClient.cs

+ 5
- 1
src/Discord.Net/DiscordSimpleClient.cs View File

@@ -122,6 +122,9 @@ namespace Discord
//Connection
public async Task<string> Connect(string gateway, string token)
{
if (gateway == null) throw new ArgumentNullException(nameof(gateway));
if (token == null) throw new ArgumentNullException(nameof(token));

try
{
_state = (int)DiscordClientState.Connecting;
@@ -283,8 +286,9 @@ namespace Discord
try { action(); }
catch (Exception ex)
{
var ex2 = ex.GetBaseException();
RaiseOnLog(LogMessageSeverity.Error, LogMessageSource.Client,
$"{name} event handler raised an exception: ${ex.GetBaseException().Message}");
$"{name}'s handler raised {ex2.GetType().Name}: ${ex2.Message}");
}
}



Loading…
Cancel
Save