Still Hsu 7 years ago
parent
commit
bf35369fe9
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/Discord.Net.Core/Utils/TokenUtils.cs

+ 4
- 4
src/Discord.Net.Core/Utils/TokenUtils.cs View File

@@ -13,13 +13,13 @@ namespace Discord
/// </summary> /// </summary>
/// <param name="tokenType"> The type of token to validate. </param> /// <param name="tokenType"> The type of token to validate. </param>
/// <param name="token"> The token value to validate. </param> /// <param name="token"> The token value to validate. </param>
/// <exception cref="ArgumentNullException"> Thrown when the supplied token string is null, empty, or contains only whitespace.</exception>
/// <exception cref="ArgumentException"> Thrown when the supplied TokenType or token value is invalid. </exception>
/// <exception cref="ArgumentNullException"> Thrown when the supplied token string is <c>null</c>, empty, or contains only whitespace.</exception>
/// <exception cref="ArgumentException"> Thrown when the supplied <see cref="TokenType"/> or token value is invalid. </exception>
public static void ValidateToken(TokenType tokenType, string token) public static void ValidateToken(TokenType tokenType, string token)
{ {
// A Null or WhiteSpace token of any type is invalid. // A Null or WhiteSpace token of any type is invalid.
if (string.IsNullOrWhiteSpace(token)) if (string.IsNullOrWhiteSpace(token))
throw new ArgumentNullException("A token cannot be null, empty, or contain only whitespace.", nameof(token));
throw new ArgumentNullException(nameof(token), "A token cannot be null, empty, or contain only whitespace.");


switch (tokenType) switch (tokenType)
{ {
@@ -38,7 +38,7 @@ namespace Discord
break; break;
default: default:
// All unrecognized TokenTypes (including User tokens) are considered to be invalid. // All unrecognized TokenTypes (including User tokens) are considered to be invalid.
throw new ArgumentException("Unrecognized TokenType.", nameof(token));
throw new ArgumentException($"Unrecognized {nameof(token)}.", nameof(token));
} }
} }




Loading…
Cancel
Save