Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dotnet/src/webdriver/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using OpenQA.Selenium.Internal;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
Expand Down Expand Up @@ -215,6 +216,21 @@ public string ToJson()
return JsonSerializer.Serialize(this);
}

/// <summary>
/// Throws if <see cref="Value"/> is <see langword="null"/>.
/// </summary>
/// <exception cref="WebDriverException">If <see cref="Value"/> is <see langword="null"/>.</exception>
[MemberNotNull(nameof(Value))]
internal Response EnsureValueIsNotNull()
{
if (Value is null)
{
throw new WebDriverException("Response from remote end doesn't have $.Value property");
}

return this;
}

/// <summary>
/// Returns the object as a string.
/// </summary>
Expand Down
Loading