Skip to content

Commit

Permalink
fix: wrap errors
Browse files Browse the repository at this point in the history
  • Loading branch information
martskins committed Oct 30, 2024
1 parent 216de17 commit 481c29b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/cockroachdb/cockroachdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,17 @@ func addTLS(ctx context.Context, container testcontainers.Container, opts option
func setRecommendedSettings(ctx context.Context, container testcontainers.Container, opts options) error {
port, err := container.MappedPort(ctx, defaultSQLPort)
if err != nil {
return err
return fmt.Errorf("mapped port: %w", err)
}

host, err := container.Host(ctx)
if err != nil {
return err
return fmt.Errorf("host: %w", err)
}

db, err := sql.Open("pgx/v5", connString(opts, host, port))
if err != nil {
return err
return fmt.Errorf("sql.Open: %w", err)
}
defer db.Close()

Expand All @@ -272,7 +272,7 @@ func setRecommendedSettings(ctx context.Context, container testcontainers.Contai
for _, stmt := range stmts {
_, err = db.Exec(stmt)
if err != nil {
return err
return fmt.Errorf("db.Exec: %w", err)
}
}

Expand Down

0 comments on commit 481c29b

Please sign in to comment.