Skip to content

Commit

Permalink
Capture errors for quality management
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS-ovm committed Jun 18, 2024
1 parent f729d5d commit cf944f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/tea_terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import (
"time"

tea "github.com/charmbracelet/bubbletea"
"github.com/getsentry/sentry-go"
"github.com/overmindtech/sdp-go"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"golang.org/x/oauth2"
)

Expand Down Expand Up @@ -123,6 +126,13 @@ func (m *cmdModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

case fatalError:
log.WithError(msg.err).WithField("msg.id", msg.id).Debug("cmdModel: fatalError received")
span := trace.SpanFromContext(m.ctx)
span.RecordError(msg.err)
span.SetAttributes(
attribute.Bool("ovm.cli.fatalError", true),
attribute.Int("ovm.cli.fatalError.id", msg.id),
)
sentry.CaptureException(msg.err)

// record the fatal error here, to repeat it at the end of the process
m.fatalError = msg.err.Error()
Expand Down

0 comments on commit cf944f9

Please sign in to comment.