Also cover Fatal and Panic logging

This commit is contained in:
David Robertson 2023-04-05 18:39:51 +01:00
parent fe8f570929
commit c4cc35fcfc
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
2 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/getsentry/sentry-go"
"os"
"strings"
@ -46,6 +47,7 @@ func NewStorage(postgresURI string) *Storage {
db, err := sqlx.Open("postgres", postgresURI)
if err != nil {
logger.Panic().Err(err).Str("uri", postgresURI).Msg("failed to open SQL DB")
sentry.CaptureException(err)
}
acc := &Accumulator{
db: db,

2
v3.go
View File

@ -3,6 +3,7 @@ package slidingsync
import (
"encoding/json"
"fmt"
"github.com/getsentry/sentry-go"
"net/http"
"os"
"strings"
@ -169,6 +170,7 @@ func RunSyncV3Server(h http.Handler, bindAddr, destV2Server, tlsCert, tlsKey str
}
if err != nil {
logger.Fatal().Err(err).Msg("failed to listen and serve")
sentry.CaptureException(err)
}
}