Browse Source

add null or whitespace check

pull/1260/head
Chris Johnston 6 years ago
parent
commit
de29a591d2
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      src/Discord.Net.Webhook/DiscordWebhookClient.cs

+ 5
- 0
src/Discord.Net.Webhook/DiscordWebhookClient.cs View File

@@ -56,8 +56,13 @@ namespace Discord.Webhook
/// <param name="webhookUrl">The url of the webhook.</param> /// <param name="webhookUrl">The url of the webhook.</param>
/// <param name="config">The configuration options to use for this client.</param> /// <param name="config">The configuration options to use for this client.</param>
/// <exception cref="ArgumentException">Thrown if the <paramref name="webhookUrl"/> is an invalid format.</exception> /// <exception cref="ArgumentException">Thrown if the <paramref name="webhookUrl"/> is an invalid format.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="webhookUrl"/> is null or whitespace.</exception>
public DiscordWebhookClient(string webhookUrl, DiscordRestConfig config) : this(config) public DiscordWebhookClient(string webhookUrl, DiscordRestConfig config) : this(config)
{ {
if (string.IsNullOrWhiteSpace(webhookUrl))
throw new ArgumentNullException(paramName: nameof(webhookUrl), message:
"The given webhook Url cannot be null or whitespace.");

// thrown when groups are not populated/valid, or when there is no match // thrown when groups are not populated/valid, or when there is no match
ArgumentException ex() ArgumentException ex()
=> new ArgumentException(paramName: nameof(webhookUrl), message: "The given webhook Url was not in a valid format."); => new ArgumentException(paramName: nameof(webhookUrl), message: "The given webhook Url was not in a valid format.");


Loading…
Cancel
Save