Skip to content

Commit 9a76e89

Browse files
committed
[dotnet] Add not-null Response.Value helper
1 parent 2357514 commit 9a76e89

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

dotnet/src/webdriver/Response.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ public string ToJson()
215215
return JsonSerializer.Serialize(this);
216216
}
217217

218+
/// <summary>
219+
/// Gets the <see cref="Value"/> of this response, or throws if it is <see langword="null"/>.
220+
/// </summary>
221+
/// <returns>The <see cref="Value"/> instance.</returns>
222+
/// <exception cref="WebDriverException">If <see cref="Value"/> is <see langword="null"/>.</exception>
223+
internal object GetNotNullValue()
224+
{
225+
return Value ?? throw new WebDriverException("Expected not-null response");
226+
}
227+
218228
/// <summary>
219229
/// Returns the object as a string.
220230
/// </summary>

0 commit comments

Comments
 (0)