Report playwright installation errors

This commit is contained in:
Bernard Xie 2022-11-17 16:49:07 -08:00
parent c2d8d17f46
commit 6a00cfb005
No known key found for this signature in database
GPG key ID: 3C3E0036CE0F892C

View file

@ -73,7 +73,7 @@ func InitPlaywright() (Playwright, error) {
cmd := exec.Command(driver.DriverBinaryLocation, "--version") cmd := exec.Command(driver.DriverBinaryLocation, "--version")
output, err := cmd.Output() output, err := cmd.Output()
if err != nil { if err != nil {
return Playwright{}, fmt.Errorf("could not install Playwright driver") return Playwright{}, fmt.Errorf("could not install Playwright driver: %v\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err.Error())
} }
if !bytes.Contains(output, []byte(driver.Version)) { if !bytes.Contains(output, []byte(driver.Version)) {
err = playwright.Install() err = playwright.Install()
@ -82,7 +82,7 @@ func InitPlaywright() (Playwright, error) {
} }
} }
} else { } else {
return Playwright{}, fmt.Errorf("could not install Playwright driver") return Playwright{}, fmt.Errorf("could not find Playwright binary: %v\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err.Error())
} }
pw, err := playwright.Run() pw, err := playwright.Run()