@@ -11,6 +11,7 @@ import (
11
11
"sync"
12
12
"time"
13
13
14
+ "github.com/getsentry/sentry-go"
14
15
"github.com/pkg/errors"
15
16
"github.com/quic-go/quic-go"
16
17
"github.com/rs/zerolog"
@@ -598,6 +599,8 @@ func (e *EdgeTunnelServer) serveQUIC(
598
599
)
599
600
if err != nil {
600
601
connLogger .ConnAwareLogger ().Err (err ).Msgf ("Failed to dial a quic connection" )
602
+
603
+ e .reportErrorToSentry (err )
601
604
return err , true
602
605
}
603
606
@@ -667,6 +670,26 @@ func (e *EdgeTunnelServer) serveQUIC(
667
670
return errGroup .Wait (), false
668
671
}
669
672
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
+
670
693
func listenReconnect (ctx context.Context , reconnectCh <- chan ReconnectSignal , gracefulShutdownCh <- chan struct {}) error {
671
694
select {
672
695
case reconnect := <- reconnectCh :
0 commit comments