Skip to content

Commit

Permalink
Log panics (#1818)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal authored Apr 9, 2024
1 parent dd0cf41 commit 90bd39c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/internal/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"runtime"
"runtime/debug"
"strings"
"time"

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 90bd39c

Please sign in to comment.