internal/lsp: log errors when diagnostics fail

This will allow us to better track the errors that might cause golang/go#30786.

Change-Id: I310ad0fd0eda3102d5763e28fc383a4994ef0ff3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172280
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/internal/lsp/diagnostics.go b/internal/lsp/diagnostics.go
index a479e67..aa9fa0f 100644
--- a/internal/lsp/diagnostics.go
+++ b/internal/lsp/diagnostics.go
@@ -22,11 +22,13 @@
 	go func() {
 		ctx := view.BackgroundContext()
 		if ctx.Err() != nil {
+			s.log.Errorf(ctx, "canceling diagnostics for %s: %v", uri, ctx.Err())
 			return
 		}
 		reports, err := source.Diagnostics(ctx, view, uri)
 		if err != nil {
-			return // handle error?
+			s.log.Errorf(ctx, "failed to compute diagnostics for %s: %v", uri, err)
+			return
 		}
 
 		s.undeliveredMu.Lock()