Skip to content

Commit 4c1f3be

Browse files
committed
Executing null command name throws, document this
1 parent 0226224 commit 4c1f3be

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Diff for: dotnet/src/webdriver/Command.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ public Command(string name, string jsonParameters)
5555
/// <param name="sessionId">Session ID the driver is using</param>
5656
/// <param name="name">Name of the command</param>
5757
/// <param name="parameters">Parameters for that command</param>
58+
/// <exception cref="ArgumentNullException">If <paramref name="name"/> is <see langword="null"/>.</exception>
5859
public Command(SessionId? sessionId, string name, Dictionary<string, object>? parameters)
5960
{
6061
this.SessionId = sessionId;
6162
this.Parameters = parameters ?? new Dictionary<string, object>();
62-
this.Name = name;
63+
this.Name = name ?? throw new ArgumentNullException(nameof(name));
6364
}
6465

6566
/// <summary>

Diff for: dotnet/src/webdriver/CommandInfoRepository.cs

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public bool IsCommandNameDefined(string commandName)
8787
/// </summary>
8888
/// <param name="commandName">The <see cref="DriverCommand"/> for which to get the information.</param>
8989
/// <returns>The <see cref="HttpCommandInfo"/> for the specified command, or <see langword="null"/> if not found or value is not <typeparamref name="T"/>.</returns>
90+
/// <exception cref="ArgumentNullException">If <paramref name="commandName"/> is <see langword="null"/>.</exception>
9091
public T? GetCommandInfo<T>(string commandName) where T : CommandInfo
9192
{
9293
T? toReturn = default;

Diff for: dotnet/src/webdriver/WebDriver.cs

+4
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ internal ReadOnlyCollection<IWebElement> GetElementsFromResponse(Response respon
566566
/// <param name="driverCommandToExecute">Command that needs executing</param>
567567
/// <param name="parameters">Parameters needed for the command</param>
568568
/// <returns>WebDriver Response</returns>
569+
/// <exception cref="ArgumentNullException">If <paramref name="driverCommandToExecute"/> is <see langword="null"/>.</exception>
569570
internal Response InternalExecute(string driverCommandToExecute, Dictionary<string, object> parameters)
570571
{
571572
return Task.Run(() => this.InternalExecuteAsync(driverCommandToExecute, parameters)).GetAwaiter().GetResult();
@@ -577,6 +578,7 @@ internal Response InternalExecute(string driverCommandToExecute, Dictionary<stri
577578
/// <param name="driverCommandToExecute">Command that needs executing</param>
578579
/// <param name="parameters">Parameters needed for the command</param>
579580
/// <returns>A task object representing the asynchronous operation</returns>
581+
/// <exception cref="ArgumentNullException">If <paramref name="driverCommandToExecute"/> is <see langword="null"/>.</exception>
580582
internal Task<Response> InternalExecuteAsync(string driverCommandToExecute,
581583
Dictionary<string, object> parameters)
582584
{
@@ -589,6 +591,7 @@ internal Task<Response> InternalExecuteAsync(string driverCommandToExecute,
589591
/// <param name="driverCommandToExecute">A <see cref="DriverCommand"/> value representing the command to execute.</param>
590592
/// <param name="parameters">A <see cref="Dictionary{K, V}"/> containing the names and values of the parameters of the command.</param>
591593
/// <returns>A <see cref="Response"/> containing information about the success or failure of the command and any data returned by the command.</returns>
594+
/// <exception cref="ArgumentNullException">If <paramref name="driverCommandToExecute"/> is <see langword="null"/>.</exception>
592595
protected virtual Response Execute(string driverCommandToExecute,
593596
Dictionary<string, object> parameters)
594597
{
@@ -601,6 +604,7 @@ protected virtual Response Execute(string driverCommandToExecute,
601604
/// <param name="driverCommandToExecute">A <see cref="DriverCommand"/> value representing the command to execute.</param>
602605
/// <param name="parameters">A <see cref="Dictionary{K, V}"/> containing the names and values of the parameters of the command.</param>
603606
/// <returns>A <see cref="Response"/> containing information about the success or failure of the command and any data returned by the command.</returns>
607+
/// <exception cref="ArgumentNullException">If <paramref name="driverCommandToExecute"/> is <see langword="null"/>.</exception>
604608
protected virtual async Task<Response> ExecuteAsync(string driverCommandToExecute, Dictionary<string, object> parameters)
605609
{
606610
Command commandToExecute = new Command(SessionId, driverCommandToExecute, parameters);

0 commit comments

Comments
 (0)