Fix swapped parameters in ArgumentException, ArgumentNullException cstrs (#1139)

* Fix swapped parameters in ArgumentException and ArgumentNullException cstrs

The constructors of ArgumentException and ArgumentNullException are inconsistent with each other, which results in their parameters being swapped here and there.

* Use named parameters for ArgumentException constructors

Cleans up some of the methods of EmbedBuilder to use simpler syntax as well
This commit is contained in:
Chris Johnston
2018-09-06 19:08:45 -07:00
committed by Christopher F
parent 272604f275
commit 9e9a11d4b0
9 changed files with 56 additions and 74 deletions

View File

@@ -78,7 +78,7 @@ namespace Discord.API
case TokenType.Bearer:
return $"Bearer {token}";
default:
throw new ArgumentException("Unknown OAuth token type", nameof(tokenType));
throw new ArgumentException(message: "Unknown OAuth token type", paramName: nameof(tokenType));
}
}
internal virtual void Dispose(bool disposing)
@@ -473,7 +473,7 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
if (args.Content?.Length > DiscordConfig.MaxMessageSize)
throw new ArgumentException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(channelId: channelId);
@@ -490,7 +490,7 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
if (args.Content?.Length > DiscordConfig.MaxMessageSize)
throw new ArgumentException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
options = RequestOptions.CreateOrClone(options);
return await SendJsonAsync<Message>("POST", () => $"webhooks/{webhookId}/{AuthToken}?wait=true", args, new BucketIds(), clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);