From 8b453eae9a1c9f3219de1c12a1c2773d634176a2 Mon Sep 17 00:00:00 2001 From: Bernard Xie Date: Thu, 17 Nov 2022 20:39:10 -0800 Subject: [PATCH] PR comments --- cmd/d2/main.go | 2 +- cmd/d2/watch.go | 2 +- lib/png/png.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/d2/main.go b/cmd/d2/main.go index b21467b9e..7aeecf923 100644 --- a/cmd/d2/main.go +++ b/cmd/d2/main.go @@ -122,7 +122,7 @@ func run(ctx context.Context, ms *xmain.State) (err error) { defer func() { cleanupErr := pw.Cleanup() if cleanupErr != nil { - ms.Log.Error.Printf("error cleaning up playwright: %v", cleanupErr.Error()) + ms.Log.Error.Printf("error cleaning up Playwright: %v", cleanupErr.Error()) } }() } diff --git a/cmd/d2/watch.go b/cmd/d2/watch.go index 0559ce04f..98a05bbdd 100644 --- a/cmd/d2/watch.go +++ b/cmd/d2/watch.go @@ -332,7 +332,7 @@ func (w *watcher) compileLoop(ctx context.Context) error { if filepath.Ext(w.outputPath) == ".png" && !w.pw.Browser.IsConnected() { newPW, err := w.pw.RestartBrowser() if err != nil { - return fmt.Errorf("playwright could not be restarted: %w", err) + return fmt.Errorf("Playwright could not be restarted: %w", err) } w.pw = newPW } diff --git a/lib/png/png.go b/lib/png/png.go index 6c2c30632..90b947800 100644 --- a/lib/png/png.go +++ b/lib/png/png.go @@ -73,7 +73,7 @@ func InitPlaywright() (Playwright, error) { cmd := exec.Command(driver.DriverBinaryLocation, "--version") output, err := cmd.Output() if err != nil { - return Playwright{}, fmt.Errorf("error getting playwright version: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err) + return Playwright{}, fmt.Errorf("error getting Playwright version: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err) } if !bytes.Contains(output, []byte(driver.Version)) { err = playwright.Install() @@ -82,7 +82,7 @@ func InitPlaywright() (Playwright, error) { } } } else { - return Playwright{}, fmt.Errorf("could not access playwright binary location: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err) + return Playwright{}, fmt.Errorf("could not access Playwright binary location: %v\nerror: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", driver.DriverBinaryLocation, err) } pw, err := playwright.Run() @@ -97,7 +97,7 @@ var genPNGScript string func ExportPNG(ms *xmain.State, page playwright.Page, svg []byte) (outputImage []byte, err error) { if page == nil { - return nil, fmt.Errorf("playwright was not initialized properly\nplease report this issue here: https://github.com/terrastruct/d2/issues/new") + return nil, fmt.Errorf("Playwright was not initialized properly\nplease report this issue here: https://github.com/terrastruct/d2/issues/new") } encodedSVG := base64.StdEncoding.EncodeToString(svg)