Wrap errors. Don't emit crash message on no oauth tokens.

This commit is contained in:
Eli Ribble 2025-11-13 20:53:20 +00:00
parent 8e71542c3f
commit 7919f0da66
No known key found for this signature in database
6 changed files with 67 additions and 58 deletions

View file

@ -78,7 +78,7 @@ func doMigrations(connection_string string) error {
func initializeDatabase(ctx context.Context, uri string) error {
needs, err := needsMigrations(uri)
if err != nil {
return fmt.Errorf("Failed to determine if migrations are needed: %v", err)
return fmt.Errorf("Failed to determine if migrations are needed: %w", err)
}
if needs == nil {
return errors.New("Can't read variable 'needs' - it's nil")
@ -88,7 +88,7 @@ func initializeDatabase(ctx context.Context, uri string) error {
log.Info().Msg("Handling database migrations")
err = doMigrations(uri)
if err != nil {
return fmt.Errorf("Failed to handle migrations: %v", err)
return fmt.Errorf("Failed to handle migrations: %w", err)
}
} else {
log.Info().Msg("No database migrations necessary")