@@ -11,6 +11,7 @@ import (
1111 "sync"
1212 "time"
1313
14+ "github.com/getsentry/sentry-go"
1415 "github.com/pkg/errors"
1516 "github.com/quic-go/quic-go"
1617 "github.com/rs/zerolog"
@@ -598,6 +599,8 @@ func (e *EdgeTunnelServer) serveQUIC(
598599 )
599600 if err != nil {
600601 connLogger .ConnAwareLogger ().Err (err ).Msgf ("Failed to dial a quic connection" )
602+
603+ e .reportErrorToSentry (err )
601604 return err , true
602605 }
603606
@@ -667,6 +670,26 @@ func (e *EdgeTunnelServer) serveQUIC(
667670 return errGroup .Wait (), false
668671}
669672
673+ // The reportErrorToSentry is an helper function that handles
674+ // verifies if an error should be reported to Sentry.
675+ func (e * EdgeTunnelServer ) reportErrorToSentry (err error ) {
676+ dialErr , ok := err .(* connection.EdgeQuicDialError )
677+ if ok {
678+ // The TransportError provides an Unwrap function however
679+ // the err MAY not always be set
680+ transportErr , ok := dialErr .Cause .(* quic.TransportError )
681+ if ok &&
682+ transportErr .ErrorCode .IsCryptoError () &&
683+ fips .IsFipsEnabled () &&
684+ e .config .FeatureSelector .PostQuantumMode () == features .PostQuantumStrict {
685+ // Only report to Sentry when using FIPS, PQ,
686+ // and the error is a Crypto error reported by
687+ // an EdgeQuicDialError
688+ sentry .CaptureException (err )
689+ }
690+ }
691+ }
692+
670693func listenReconnect (ctx context.Context , reconnectCh <- chan ReconnectSignal , gracefulShutdownCh <- chan struct {}) error {
671694 select {
672695 case reconnect := <- reconnectCh :
0 commit comments