Skip to content

Commit c16dd3d

Browse files
committed
feat: improve PG database initialization errors
1 parent 94d7d68 commit c16dd3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

backends/postgres/postgres_backend.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func Backend(ctx context.Context, opts ...neoq.ConfigOption) (pb neoq.Neoq, err
146146

147147
err = p.initializeDB()
148148
if err != nil {
149-
return
149+
return nil, fmt.Errorf("unable to initialize jobs database: %w", err)
150150
}
151151

152152
if p.pool == nil { //nolint: nestif
@@ -175,13 +175,14 @@ func Backend(ctx context.Context, opts ...neoq.ConfigOption) (pb neoq.Neoq, err
175175

176176
p.pool, err = pgxpool.NewWithConfig(ctx, poolConfig)
177177
if err != nil {
178-
return
178+
return nil, fmt.Errorf("unable to create worker connection pool: %w", err)
179179
}
180180
}
181181

182182
p.listenerConn, err = p.newListenerConn(ctx)
183183
if err != nil {
184184
p.logger.Error("unable to initialize listener connection", slog.Any("error", err))
185+
return nil, fmt.Errorf("unable to create neoq listener connection: %w", err)
185186
}
186187

187188
// monitor handlers for changes and LISTEN when new queues are added

0 commit comments

Comments
 (0)