Skip to content

Commit

Permalink
fixes panic recovery in nodehost.NewNodeHost
Browse files Browse the repository at this point in the history
  • Loading branch information
tephrocactus committed Oct 11, 2024
1 parent 6a16231 commit e6e0716
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nodehost.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,11 @@ func NewNodeHost(nhConfig config.NodeHostConfig) (*NodeHost, error) {
defer func() {
if r := recover(); r != nil {
nh.Close()
if r, ok := r.(error); ok {
panicNow(r)
switch err := r.(type) {
case error:
panicNow(err)
case string:
panicNow(errors.New(err))
}
}
}()
Expand Down

0 comments on commit e6e0716

Please sign in to comment.