Browse Source

NullOrEmpty -> NullOrWhiteSpace (#758)

Seeing as D.NET will warn you about an impending BadRequest if you try and send an empty field, why not make it warn about the impending BadRequest if you try and send a whitespace field?
tags/2.0.0-beta
Jay Malhotra RogueException 7 years ago
parent
commit
57a461c9ff
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs

+ 1
- 1
src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs View File

@@ -249,7 +249,7 @@ namespace Discord
get => _field.Name;
set
{
if (string.IsNullOrEmpty(value)) throw new ArgumentException($"Field name must not be null or empty.", nameof(Name));
if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException($"Field name must not be null, empty or entirely whitespace.", nameof(Name));
if (value.Length > MaxFieldNameLength) throw new ArgumentException($"Field name length must be less than or equal to {MaxFieldNameLength}.", nameof(Name));
_field.Name = value;
}


Loading…
Cancel
Save