mirror of
https://github.com/elyby/accounts-profiles-endpoint.git
synced 2024-11-29 18:22:02 +05:30
Improve panic messages and remove Modules integration for Sentry
This commit is contained in:
parent
38738d3ab7
commit
5ee1a88546
20
main.go
20
main.go
@ -18,9 +18,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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 {
|
if err != nil {
|
||||||
panic(err)
|
panic(fmt.Errorf("unable to initialize Sentry: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
defer sentry.Flush(2 * time.Second)
|
defer sentry.Flush(2 * time.Second)
|
||||||
@ -48,7 +60,7 @@ func main() {
|
|||||||
viper.GetString("mysql.db"),
|
viper.GetString("mysql.db"),
|
||||||
))
|
))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(fmt.Errorf("invalid MySQL connection params: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
db.SetConnMaxLifetime(time.Minute * 3)
|
db.SetConnMaxLifetime(time.Minute * 3)
|
||||||
@ -57,7 +69,7 @@ func main() {
|
|||||||
|
|
||||||
findAccountByUuidStmt, err := db.Prepare("SELECT username FROM accounts WHERE uuid = ? LIMIT 1")
|
findAccountByUuidStmt, err := db.Prepare("SELECT username FROM accounts WHERE uuid = ? LIMIT 1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(fmt.Errorf("unable to prepare query: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
router := httprouter.New()
|
router := httprouter.New()
|
||||||
|
Loading…
Reference in New Issue
Block a user