pr278: Review fixes

This commit is contained in:
Anmol Sethi 2022-11-30 14:40:11 -08:00
parent 39a990364d
commit e3104688a6
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
3 changed files with 6 additions and 6 deletions

View file

@ -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)
}

View file

@ -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,
})

View file

@ -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()