Skip to content

Commit ffd8a35

Browse files
committed
Adding exception handling in .NET WebDriverBackedSelenium
Against my better judgement making any changes here whatsoever. Fixes issue #4248.
1 parent ebb1a33 commit ffd8a35

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

dotnet/src/core/SeleniumException.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,14 @@ public SeleniumException()
3939
public SeleniumException(string message) : base(message)
4040
{
4141
}
42+
43+
/// <summary>
44+
/// Creates an exception with the specified message and inner exception
45+
/// </summary>
46+
/// <param name="message">the message to add to the exception</param>
47+
/// <param name="innerException">the inner exception wrapped by this exception</param>
48+
public SeleniumException(string message, Exception innerException) : base(message, innerException)
49+
{
50+
}
4251
}
4352
}

dotnet/src/webdriverbackedselenium/Internal/CommandTimer.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ private void RunCommand()
7777
{
7878
this.thrownException = e;
7979
}
80+
catch (WebDriverException e)
81+
{
82+
this.thrownException = new SeleniumException("WebDriver exception thrown", e);
83+
}
84+
catch (InvalidOperationException e)
85+
{
86+
this.thrownException = new SeleniumException("WebDriver exception thrown", e);
87+
}
8088
}
8189
}
8290
}

0 commit comments

Comments
 (0)