Skip to content

Commit 3d085be

Browse files
committed
minimize diffs
1 parent 9fe018d commit 3d085be

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dotnet/src/webdriver/DriverService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ protected virtual bool IsInitialized
187187
/// <returns>A task that represents the asynchronous initialization check operation.</returns>
188188
protected async virtual Task<bool> IsInitializedAsync()
189189
{
190+
bool isInitialized = false;
190191
try
191192
{
192193
using (var httpClient = new HttpClient())
@@ -201,16 +202,16 @@ protected async virtual Task<bool> IsInitializedAsync()
201202
// that the HTTP status returned is a 200 status, and that the response has the correct
202203
// Content-Type header. A more sophisticated check would parse the JSON response and
203204
// validate its values. At the moment we do not do this more sophisticated check.
204-
bool isInitialized = response.StatusCode == HttpStatusCode.OK && response.Content.Headers.ContentType is { MediaType: string mediaType } && mediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase);
205-
206-
return isInitialized;
205+
isInitialized = response.StatusCode == HttpStatusCode.OK && response.Content.Headers.ContentType is { MediaType: string mediaType } && mediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase);
207206
}
208207
}
209208
}
210209
catch (Exception ex) when (ex is HttpRequestException || ex is TaskCanceledException)
211210
{
212-
return false;
211+
// Do nothing. The exception is expected, meaning driver service is not initialized.
213212
}
213+
214+
return isInitialized;
214215
}
215216

216217
/// <summary>

0 commit comments

Comments
 (0)