@@ -126,25 +126,25 @@ func runMigrations(databaseURL string) error {
126126func NewSystemDatabase (databaseURL string ) (SystemDatabase , error ) {
127127 // Create the database if it doesn't exist
128128 if err := createDatabaseIfNotExists (databaseURL ); err != nil {
129- return nil , NewInitializationError ( fmt .Sprintf ("failed to create database: %v" , err ) )
129+ return nil , fmt .Errorf ("failed to create database: %v" , err )
130130 }
131131
132132 // Run migrations first
133133 if err := runMigrations (databaseURL ); err != nil {
134- return nil , NewInitializationError ( fmt .Sprintf ("failed to run migrations: %v" , err ) )
134+ return nil , fmt .Errorf ("failed to run migrations: %v" , err )
135135 }
136136
137137 // Create pgx pool
138138 pool , err := pgxpool .New (context .Background (), databaseURL )
139139 if err != nil {
140- return nil , NewInitializationError ( fmt .Sprintf ("failed to create connection pool: %v" , err ) )
140+ return nil , fmt .Errorf ("failed to create connection pool: %v" , err )
141141 }
142142
143143 // Test the connection
144144 // FIXME: remove this
145145 if err := pool .Ping (context .Background ()); err != nil {
146146 pool .Close ()
147- return nil , NewInitializationError ( fmt .Sprintf ("failed to ping database: %v" , err ) )
147+ return nil , fmt .Errorf ("failed to ping database: %v" , err )
148148 }
149149
150150 // Create a map of notification payloads to channels
@@ -153,7 +153,7 @@ func NewSystemDatabase(databaseURL string) (SystemDatabase, error) {
153153 // Create a connection to listen on notifications
154154 config , err := pgconn .ParseConfig (databaseURL )
155155 if err != nil {
156- return nil , NewInitializationError ( fmt .Sprintf ("failed to parse database URL: %v" , err ) )
156+ return nil , fmt .Errorf ("failed to parse database URL: %v" , err )
157157 }
158158 config .OnNotification = func (c * pgconn.PgConn , n * pgconn.Notification ) {
159159 if n .Channel == "dbos_notifications_channel" {
@@ -170,7 +170,7 @@ func NewSystemDatabase(databaseURL string) (SystemDatabase, error) {
170170 }
171171 notificationListenerConnection , err := pgconn .ConnectConfig (context .Background (), config )
172172 if err != nil {
173- return nil , NewInitializationError ( fmt .Sprintf ("failed to connect notification listener to database: %v" , err ) )
173+ return nil , fmt .Errorf ("failed to connect notification listener to database: %v" , err )
174174 }
175175
176176 return & systemDatabase {
0 commit comments