health: don't show login error details with context cancelations

Fixes #12991

Change-Id: I2a5e109395761b720ecf1069d0167cf0caf72876
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2024-08-01 08:01:21 -07:00 committed by Brad Fitzpatrick
parent 655b4f8fc5
commit cc370314e7

View File

@ -6,6 +6,7 @@
package health package health
import ( import (
"context"
"errors" "errors"
"fmt" "fmt"
"maps" "maps"
@ -987,8 +988,12 @@ func (t *Tracker) updateBuiltinWarnablesLocked() {
} }
if t.lastLoginErr != nil { if t.lastLoginErr != nil {
var errMsg string
if !errors.Is(t.lastLoginErr, context.Canceled) {
errMsg = t.lastLoginErr.Error()
}
t.setUnhealthyLocked(LoginStateWarnable, Args{ t.setUnhealthyLocked(LoginStateWarnable, Args{
ArgError: t.lastLoginErr.Error(), ArgError: errMsg,
}) })
return return
} else { } else {