ensure that panics are written to the log file.

This commit is contained in:
Jason Kulatunga 2024-01-22 23:00:03 -08:00
parent e2fa94545f
commit 27297f8eb6
No known key found for this signature in database
1 changed files with 14 additions and 0 deletions

View File

@ -104,6 +104,13 @@ func main() {
return err
}
// ensure panics are written to the log file.
defer func() {
if err := recover(); err != nil {
appLogger.Panic("panic occurred:", err)
}
}()
settingsData, err := json.Marshal(appconfig.AllSettings())
appLogger.Debug(string(settingsData), err)
@ -171,6 +178,13 @@ func main() {
return err
}
// ensure panics are written to the log file.
defer func() {
if err := recover(); err != nil {
appLogger.Panic("panic occurred:", err)
}
}()
_, err = database.NewRepository(appconfig, appLogger, event_bus.NewNoopEventBusServer())
return err
},