diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-09-08 19:24:25 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-09-08 19:24:25 +0200 |
commit | cda7f02569e1ad214eb0755527038784cfd54467 (patch) | |
tree | 026b2a9d1ccace5af684483d6456978424a505c2 /pkg/vpn/bonafide/auth_sip.go | |
parent | 2f1f352342e8e707beabd8d0c180887182e28c9a (diff) |
[refactor] fix error handling after review
Diffstat (limited to 'pkg/vpn/bonafide/auth_sip.go')
-rw-r--r-- | pkg/vpn/bonafide/auth_sip.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/vpn/bonafide/auth_sip.go b/pkg/vpn/bonafide/auth_sip.go index 0c8ee4f..5da562d 100644 --- a/pkg/vpn/bonafide/auth_sip.go +++ b/pkg/vpn/bonafide/auth_sip.go @@ -70,25 +70,27 @@ func writeToken(token []byte) { tp := getTokenPath() err := ioutil.WriteFile(tp, token, 0600) if err != nil { - log.Println("BUG: cannot write token to", tp) + log.Println("BUG: cannot write token to", tp, err) } } func readToken() ([]byte, error) { f, err := os.Open(getTokenPath()) if err != nil { - log.Println("Error: cannot open token file") + log.Println("Error: cannot open token file", err) return nil, err } token, err := ioutil.ReadAll(f) if err != nil { - log.Println("Error: cannot read token") + log.Println("Error: cannot read token", err) return nil, err } return token, nil } func hasRecentToken() bool { + /* See https://0xacab.org/leap/bitmask-vpn/-/issues/346 for ability to refresh tokens, + when implemented that should be tried in a goroutine */ statinfo, err := os.Stat(getTokenPath()) if err != nil { return false |