Skip to content

Commit ce2d395

Browse files
Skip logging on canceled context
Happens often in tests. We could just remove the log, but feels useful.
1 parent 5c67326 commit ce2d395

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

private/buf/buflsp/image.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ func buildImage(
8585
var diagnostics []protocol.Diagnostic
8686
compiled, err := compiler.Compile(ctx, path)
8787
if err != nil {
88-
logger.WarnContext(ctx, "error building image", slog.String("path", path), xslog.ErrorAttr(err))
88+
if !errors.Is(err, context.Canceled) {
89+
logger.WarnContext(ctx, "error building image", slog.String("path", path), xslog.ErrorAttr(err))
90+
}
8991
var errorWithPos reporter.ErrorWithPos
9092
if errors.As(err, &errorWithPos) {
9193
diagnostics = []protocol.Diagnostic{newDiagnostic(errorWithPos, false, opener, logger)}

0 commit comments

Comments
 (0)