From 383ac00d17f305300c27e58859446283996c772d Mon Sep 17 00:00:00 2001 From: Safeer Jiwan Date: Wed, 14 Aug 2024 11:27:35 -0700 Subject: [PATCH] wrap errs --- backend/controller/sql/databasetesting/devel.go | 2 +- internal/modulecontext/database.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/controller/sql/databasetesting/devel.go b/backend/controller/sql/databasetesting/devel.go index b1c4e3dd18..a52f3fb4c2 100644 --- a/backend/controller/sql/databasetesting/devel.go +++ b/backend/controller/sql/databasetesting/devel.go @@ -74,7 +74,7 @@ func CreateForDevel(ctx context.Context, dsn string, recreate bool) (*stdsql.DB, realConn, err := stdsql.Open("pgx", dsn) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to open database: %w", err) } // Reset transient state in the database to a clean state for development purposes. // This includes things like resetting the state of async calls, leases, diff --git a/internal/modulecontext/database.go b/internal/modulecontext/database.go index a24080580b..fef41e6f54 100644 --- a/internal/modulecontext/database.go +++ b/internal/modulecontext/database.go @@ -21,7 +21,7 @@ type Database struct { func NewDatabase(dbType DBType, dsn string) (Database, error) { db, err := sql.Open("pgx", dsn) if err != nil { - return Database{}, err + return Database{}, fmt.Errorf("failed to bring up DB connection: %w", err) } return Database{ DSN: dsn,