mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 08:57:33 +00:00
chore(database): enhance error handling (#10279)
This PR enhances error handling in the database package by introducing custom error types that wrap dialect-specific errors, providing better abstraction and context for error handling across the application. * Introduces standardized custom error types for common database errors (no rows found, integrity violations, etc.) * Wraps all PostgreSQL-specific errors at the dialect layer to provide consistent error handling # Which Problems Are Solved The database package didn't wrap the errors from dialect specifc packages. # How the Problems Are Solved Custom errors were added which wrap the dialect specifc errors. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -41,10 +41,10 @@ type Config struct {
|
||||
func (c *Config) Connect(ctx context.Context) (database.Pool, error) {
|
||||
pool, err := c.getPool(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, wrapError(err)
|
||||
}
|
||||
if err = pool.Ping(ctx); err != nil {
|
||||
return nil, err
|
||||
return nil, wrapError(err)
|
||||
}
|
||||
return &pgxPool{Pool: pool}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user