Skip to content

Commit

Permalink
Improve panic messages and remove Modules integration for Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
erickskrauch committed Jun 10, 2024
1 parent 38738d3 commit 5ee1a88
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,21 @@ import (
)

func main() {
err := sentry.Init(sentry.ClientOptions{})
err := sentry.Init(sentry.ClientOptions{
Integrations: func(integrations []sentry.Integration) []sentry.Integration {
nDeleted := 0
for i, integration := range integrations {
if integration.Name() == "Modules" {
integrations[i] = integrations[len(integrations)-(nDeleted+1)]
nDeleted++
}
}

return integrations[:len(integrations)-nDeleted]
},
})
if err != nil {
panic(err)
panic(fmt.Errorf("unable to initialize Sentry: %w", err))
}

defer sentry.Flush(2 * time.Second)
Expand Down Expand Up @@ -48,7 +60,7 @@ func main() {
viper.GetString("mysql.db"),
))
if err != nil {
panic(err)
panic(fmt.Errorf("invalid MySQL connection params: %w", err))
}

db.SetConnMaxLifetime(time.Minute * 3)
Expand All @@ -57,7 +69,7 @@ func main() {

findAccountByUuidStmt, err := db.Prepare("SELECT username FROM accounts WHERE uuid = ? LIMIT 1")
if err != nil {
panic(err)
panic(fmt.Errorf("unable to prepare query: %w", err))
}

router := httprouter.New()
Expand Down

0 comments on commit 5ee1a88

Please sign in to comment.