Skip to content

Commit

Permalink
fix: print stacktrace if panic occurs during deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Aug 7, 2023
1 parent e6905a1 commit dac3c3f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cluster/kube/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"runtime/debug"
"strings"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -242,8 +243,8 @@ func (c *client) Deploy(ctx context.Context, deployment ctypes.IDeployment) (err
defer func() {
tmpErr := err

if r := recover(); r != nil {
c.log.Error(fmt.Sprintf("recovered from panic: %v", r))
if recover() != nil {
c.log.Error(fmt.Sprintf("recovered from panic: \n%s", string(debug.Stack())))
err = kubeclienterrors.ErrInternalError
}

Expand Down

0 comments on commit dac3c3f

Please sign in to comment.