Skip to content

Commit

Permalink
imrpoved logger for carina command executor and added todo for #1361
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelendik committed Nov 26, 2021
1 parent 85f7b50 commit e66e9a2
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.lang.invoke.MethodHandles;
import java.net.URL;

import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.remote.Command;
import org.openqa.selenium.remote.HttpCommandExecutor;
Expand Down Expand Up @@ -48,14 +49,18 @@ public Response execute(Command command) throws IOException {
Number pause = Configuration.getInt(Parameter.EXPLICIT_TIMEOUT) / retry;
while (retry > 0) {
response = super.execute(command);
String msg = response.getValue().toString();
if (response.getValue() instanceof WebDriverException) {
LOGGER.error("Temp CarinaCommandExecutor catched: " + response.getValue().toString());
String msg = response.getValue().toString();
if (msg.contains(SpecialKeywords.DRIVER_CONNECTION_REFUSED)
|| msg.contains(SpecialKeywords.DRIVER_CONNECTION_REFUSED2)) {
LOGGER.warn("Enabled command executor retries: " + msg);
LOGGER.warn("Enabled command executor retries due to the " + SpecialKeywords.DRIVER_CONNECTION_REFUSED);
CommonUtils.pause(pause);
}
} else if (response.getValue() instanceof NoSuchSessionException) {
LOGGER.error("Session died! " + msg);
//TODO: #1361 don't do driver.quit call if driver wasn't started or was terminated
// implement sessionId parser and removal/making existing driver as dead
break;
} else {
// do nothing as response already contains all the information we need
break;
Expand Down

0 comments on commit e66e9a2

Please sign in to comment.