libtailscale: don't log syspolicy.ErrNoSuchKey (#348)

There is no value in logging when syspolicy.ErrNoSuchKey is returning from the syspolicy handler, so we just shouldn't. The `failed to get string value` error message was very likely to lead to confusion over its meaning.

Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
pull/349/head
Andrea Gottardo 7 months ago committed by GitHub
parent b06342629f
commit 7119424e32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,6 +4,7 @@
package libtailscale
import (
"errors"
"log"
"tailscale.com/util/syspolicy"
@ -20,7 +21,7 @@ func (h syspolicyHandler) ReadString(key string) (string, error) {
return "", syspolicy.ErrNoSuchKey
}
retVal, err := h.a.appCtx.GetSyspolicyStringValue(key)
if err != nil {
if err != nil && !errors.Is(err, syspolicy.ErrNoSuchKey) {
log.Printf("syspolicy: failed to get string value via gomobile: %v", err)
}
return retVal, err
@ -31,7 +32,7 @@ func (h syspolicyHandler) ReadBoolean(key string) (bool, error) {
return false, syspolicy.ErrNoSuchKey
}
retVal, err := h.a.appCtx.GetSyspolicyBooleanValue(key)
if err != nil {
if err != nil && !errors.Is(err, syspolicy.ErrNoSuchKey) {
log.Printf("syspolicy: failed to get bool value via gomobile: %v", err)
}
return retVal, err

Loading…
Cancel
Save