Skip to content

Commit ad4a185

Browse files
committed
minor: renamed some errors
1 parent 4cb07ef commit ad4a185

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

errors.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ var (
1515
ErrEmptyDataSourceName = errors.New("data source name cannot be empty")
1616
ErrNilQuery = errors.New("sql query cannot be nil")
1717
ErrNilRow = errors.New("sql row cannot be nil")
18-
ErrNilConnHandler = errors.New("connection handler cannot be nil")
19-
ErrNilPoolHandler = errors.New("pool handler cannot be nil")
20-
ErrNilPoolConfig = errors.New("pool config cannot be nil")
18+
ErrNilHandler = errors.New("connection handler cannot be nil")
2119
ErrNilService = errors.New("database service cannot be nil")
2220
)

mongodb/connection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func NewDefaultHandler(config *Config) (
5858
// - error: error if any
5959
func (d *DefaultHandler) Connect() (*mongo.Client, error) {
6060
if d == nil {
61-
return nil, godatabases.ErrNilConnHandler
61+
return nil, godatabases.ErrNilHandler
6262
}
6363

6464
// Lock the mutex to ensure thread safety
@@ -98,7 +98,7 @@ func (d *DefaultHandler) Connect() (*mongo.Client, error) {
9898
// - error: error if any
9999
func (d *DefaultHandler) Client() (*mongo.Client, error) {
100100
if d == nil {
101-
return nil, godatabases.ErrNilConnHandler
101+
return nil, godatabases.ErrNilHandler
102102
}
103103

104104
// Lock the mutex to ensure thread safety

redis/connection.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewDefaultHandler(config *Config) (
5656
// - error: error if the connection fails or is already established
5757
func (d *DefaultHandler) Connect() (*redis.Client, error) {
5858
if d == nil {
59-
return nil, godatabases.ErrNilConnHandler
59+
return nil, godatabases.ErrNilHandler
6060
}
6161

6262
// Mutex lock to ensure thread safety
@@ -91,7 +91,7 @@ func (d *DefaultHandler) Connect() (*redis.Client, error) {
9191
// - error: error if the connection is not established
9292
func (d *DefaultHandler) Client() (*redis.Client, error) {
9393
if d == nil {
94-
return nil, godatabases.ErrNilConnHandler
94+
return nil, godatabases.ErrNilHandler
9595
}
9696

9797
// Mutex lock to ensure thread safety
@@ -113,7 +113,7 @@ func (d *DefaultHandler) Client() (*redis.Client, error) {
113113
// - error: error if the disconnection fails
114114
func (d *DefaultHandler) Disconnect() error {
115115
if d == nil {
116-
return godatabases.ErrNilConnHandler
116+
return godatabases.ErrNilHandler
117117
}
118118

119119
// Mutex lock to ensure thread safety

sql/connection.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func NewDefaultHandler(
4646
// - error: if any error occurred
4747
func (d *DefaultHandler) Connect() (*sql.DB, error) {
4848
if d == nil {
49-
return nil, godatabases.ErrNilConnHandler
49+
return nil, godatabases.ErrNilHandler
5050
}
5151

5252
// Lock the mutex to ensure thread safety
@@ -85,7 +85,7 @@ func (d *DefaultHandler) Connect() (*sql.DB, error) {
8585
// - error: if any error occurred
8686
func (d *DefaultHandler) DB() (*sql.DB, error) {
8787
if d == nil {
88-
return nil, godatabases.ErrNilConnHandler
88+
return nil, godatabases.ErrNilHandler
8989
}
9090

9191
// Lock the mutex to ensure thread safety
@@ -106,7 +106,7 @@ func (d *DefaultHandler) DB() (*sql.DB, error) {
106106
// - error: if any error occurred
107107
func (d *DefaultHandler) Disconnect() error {
108108
if d == nil {
109-
return godatabases.ErrNilConnHandler
109+
return godatabases.ErrNilHandler
110110
}
111111

112112
// Lock the mutex to ensure thread safety

sql/pgxpool/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func NewConfig(
6868
// - *pgxpool.Config: the parsed configuration
6969
func (c *Config) ParsedConfig() (*pgxpool.Config, error) {
7070
if c == nil {
71-
return nil, godatabases.ErrNilPoolConfig
71+
return nil, godatabases.ErrNilConfig
7272
}
7373

7474
// Create a new parsed configuration

sql/pgxpool/pool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewDefaultHandler(
4242
// Connect returns a new connection pool
4343
func (d *DefaultHandler) Connect() (*pgxpool.Pool, error) {
4444
if d == nil {
45-
return nil, godatabases.ErrNilConnHandler
45+
return nil, godatabases.ErrNilHandler
4646
}
4747

4848
// Lock the mutex to ensure thread safety
@@ -75,7 +75,7 @@ func (d *DefaultHandler) Connect() (*pgxpool.Pool, error) {
7575
// - error: if the connection is not established
7676
func (d *DefaultHandler) Pool() (*pgxpool.Pool, error) {
7777
if d == nil {
78-
return nil, godatabases.ErrNilPoolHandler
78+
return nil, godatabases.ErrNilHandler
7979
}
8080

8181
// Lock the mutex to ensure thread safety

0 commit comments

Comments
 (0)