I catch Exception
.
I would like to do something if that is a specific error. I can easily identify it with the string.
However I wondered if there is a cleaner way to do this. For example, when I create my own wrapper for exception I add an index.
Is there such a thing in default exception?
The function I use that throws errors is an instantiation of RemoteWebDriver
(selenium object). However I don't need an answer specific for that class.
To be more precise, I catch the following error: OpenQA.Selenium.WebDriverException
.
However it may be thrown if there is a timeout when creating a driver or if a js file is closed. They have the save HResult
.
So I see no way to differentiate them other than to check string unfortunately...