Log panics (#1818)

This commit is contained in:
Viktor Liu 2024-04-09 20:27:27 +02:00 committed by GitHub
parent dd0cf41147
commit 90bd39c740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"runtime"
"runtime/debug"
"strings"
"time"
@ -94,6 +95,12 @@ func runClient(
relayProbe *Probe,
wgProbe *Probe,
) error {
defer func() {
if r := recover(); r != nil {
log.Panicf("Panic occurred: %v, stack trace: %s", r, string(debug.Stack()))
}
}()
log.Infof("starting NetBird client version %s on %s/%s", version.NetbirdVersion(), runtime.GOOS, runtime.GOARCH)
// Check if client was not shut down in a clean way and restore DNS config if required.