1
0
mirror of synced 2026-05-22 18:53:15 +00:00

chore: give more friendly exception info while create driver (#181)

This commit is contained in:
codeboyzhou
2021-01-05 02:56:03 +08:00
committed by GitHub
parent 68a0b74215
commit 2ce8321178
2 changed files with 12 additions and 4 deletions
@@ -43,14 +43,18 @@ public abstract class Driver {
try {
instance = createDriver();
} catch (Exception exception) {
throw new RuntimeException("Failed to find playwright-cli", exception);
throw new RuntimeException("Failed to create driver", exception);
}
}
String name = System.getProperty("os.name").toLowerCase().contains("windows") ?
"playwright-cli.exe" : "playwright-cli";
String name = instance.cliFileName();
return instance.driverDir().resolve(name);
}
protected String cliFileName() {
return System.getProperty("os.name").toLowerCase().contains("windows") ?
"playwright-cli.exe" : "playwright-cli";
}
private static Driver createDriver() throws Exception {
String pathFromProperty = System.getProperty("playwright.cli.dir");
if (pathFromProperty != null) {