handle cleanup error correctly
This commit is contained in:
parent
530c70445a
commit
93ed44c978
2 changed files with 6 additions and 3 deletions
|
|
@ -120,7 +120,10 @@ func run(ctx context.Context, ms *xmain.State) (err error) {
|
|||
return err
|
||||
}
|
||||
defer func() {
|
||||
err = pw.Cleanup()
|
||||
cleanupErr := pw.Cleanup()
|
||||
if cleanupErr != nil {
|
||||
ms.Log.Error.Printf("error cleaning up playwright: %v", cleanupErr.Error())
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ func ExportPNG(ms *xmain.State, page playwright.Page, svg []byte) (outputImage [
|
|||
pngString := fmt.Sprintf("%v", pngInterface)
|
||||
pngPrefix := "data:image/png;base64,"
|
||||
if !strings.HasPrefix(pngString, pngPrefix) {
|
||||
if len(pngString) > 20 {
|
||||
pngString = pngString[0:20] + "..."
|
||||
if len(pngString) > 50 {
|
||||
pngString = pngString[0:50] + "..."
|
||||
}
|
||||
return nil, fmt.Errorf("invalid PNG: %v\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", pngString)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue