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>
This commit is contained in:
Rebecca Stambler 2019-04-16 12:58:00 -04:00
parent 9c9e1878f4
commit 3e7148b2fa
1 changed files with 3 additions and 1 deletions

View File

@ -22,11 +22,13 @@ func (s *Server) cacheAndDiagnose(ctx context.Context, uri span.URI, content str
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()