diff --git a/cmd/d2/main.go b/cmd/d2/main.go index 95004a49b..ffcb4509d 100644 --- a/cmd/d2/main.go +++ b/cmd/d2/main.go @@ -172,7 +172,7 @@ func run(ctx context.Context, ms *xmain.State) (err error) { _, written, err := compile(ctx, ms, plugin, *themeFlag, inputPath, outputPath, *bundleFlag, pw.Page) if err != nil { if written { - return fmt.Errorf("failed to compile (partial render written): %w", err) + return fmt.Errorf("failed to fully compile (partial render written): %w", err) } return fmt.Errorf("failed to compile: %w", err) } diff --git a/cmd/d2/watch.go b/cmd/d2/watch.go index cd64db9a3..a09034e4d 100644 --- a/cmd/d2/watch.go +++ b/cmd/d2/watch.go @@ -346,11 +346,11 @@ func (w *watcher) compileLoop(ctx context.Context) error { w.pw = newPW } - b, _, err := compile(ctx, w.ms, w.layoutPlugin, w.themeID, w.inputPath, w.outputPath, w.bundle, w.pw.Page) + svg, _, err := compile(ctx, w.ms, w.layoutPlugin, w.themeID, w.inputPath, w.outputPath, w.bundle, w.pw.Page) errs := "" if err != nil { - if len(b) > 0 { - err = fmt.Errorf("failed to %scompile (rendering partial svg): %w", recompiledPrefix, err) + if len(svg) > 0 { + err = fmt.Errorf("failed to fully %scompile (rendering partial svg): %w", recompiledPrefix, err) } else { err = fmt.Errorf("failed to %scompile: %w", recompiledPrefix, err) } @@ -360,7 +360,7 @@ func (w *watcher) compileLoop(ctx context.Context) error { w.ms.Log.Success.Printf("successfully %scompiled %v to %v", recompiledPrefix, w.inputPath, w.outputPath) } w.broadcast(&compileResult{ - SVG: string(b), + SVG: string(svg), Err: errs, }) diff --git a/lib/imgbundler/imgbundler.go b/lib/imgbundler/imgbundler.go index b91a0d164..c0e7eec5d 100644 --- a/lib/imgbundler/imgbundler.go +++ b/lib/imgbundler/imgbundler.go @@ -105,7 +105,7 @@ func runWorkers(ctx context.Context, ms *xmain.State, svg []byte, imgs [][][]byt bundledImage, err := worker(ctx, img[1], isRemote) if err != nil { - ms.Log.Error.Printf("failed to bundle %s: %v", img[0], err) + ms.Log.Error.Printf("failed to bundle %s: %v", img[1], err) errhrefsMu.Lock() errhrefs = append(errhrefs, string(img[1])) errhrefsMu.Unlock()