mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-28 20:12:27 +00:00
ipn/ipnlocal, control/controlclient: don't propagate all map errors to UI
Fixes regression from 81cabf48ec1f0d306f7dcf0c8a58a6eae6594c76 which made all map errors be sent to the frontend UI. Fixes #3230 Change-Id: I7f142c801c7d15e268a24ddf901c3e6348b6729c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
0532eb30db
commit
337757a819
@ -79,3 +79,9 @@ type Client interface {
|
|||||||
// requesting a DNS record be created or updated.
|
// requesting a DNS record be created or updated.
|
||||||
SetDNS(context.Context, *tailcfg.SetDNSRequest) error
|
SetDNS(context.Context, *tailcfg.SetDNSRequest) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserVisibleError is an error that should be shown to users.
|
||||||
|
type UserVisibleError string
|
||||||
|
|
||||||
|
func (e UserVisibleError) Error() string { return string(e) }
|
||||||
|
func (e UserVisibleError) UserVisibleError() string { return string(e) }
|
||||||
|
@ -431,7 +431,7 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
|
|||||||
resp.NodeKeyExpired, resp.MachineAuthorized, resp.AuthURL != "")
|
resp.NodeKeyExpired, resp.MachineAuthorized, resp.AuthURL != "")
|
||||||
|
|
||||||
if resp.Error != "" {
|
if resp.Error != "" {
|
||||||
return false, "", errors.New(resp.Error)
|
return false, "", UserVisibleError(resp.Error)
|
||||||
}
|
}
|
||||||
if resp.NodeKeyExpired {
|
if resp.NodeKeyExpired {
|
||||||
if regen {
|
if regen {
|
||||||
|
@ -452,10 +452,13 @@ func (b *LocalBackend) setClientStatus(st controlclient.Status) {
|
|||||||
// TODO(crawshaw): display in the UI.
|
// TODO(crawshaw): display in the UI.
|
||||||
if errors.Is(st.Err, io.EOF) {
|
if errors.Is(st.Err, io.EOF) {
|
||||||
b.logf("[v1] Received error: EOF")
|
b.logf("[v1] Received error: EOF")
|
||||||
} else {
|
return
|
||||||
b.logf("Received error: %v", st.Err)
|
}
|
||||||
e := st.Err.Error()
|
b.logf("Received error: %v", st.Err)
|
||||||
b.send(ipn.Notify{ErrMessage: &e})
|
var uerr controlclient.UserVisibleError
|
||||||
|
if errors.As(st.Err, &uerr) {
|
||||||
|
s := uerr.UserVisibleError()
|
||||||
|
b.send(ipn.Notify{ErrMessage: &s})
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user