From 665baa88f375a28ef207009babca65e25c64cd27 Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Fri, 16 May 2025 11:15:05 -0400 Subject: [PATCH] Export pool errors for public consumption --- error.go | 7 +++++++ export_test.go | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/error.go b/error.go index 6f47f7cf2c..8c811966fb 100644 --- a/error.go +++ b/error.go @@ -15,6 +15,13 @@ import ( // ErrClosed performs any operation on the closed client will return this error. var ErrClosed = pool.ErrClosed +// ErrPoolExhausted is returned from a pool connection method +// when the maximum number of database connections in the pool has been reached. +var ErrPoolExhausted = pool.ErrPoolExhausted + +// ErrPoolTimeout timed out waiting to get a connection from the connection pool. +var ErrPoolTimeout = pool.ErrPoolTimeout + // HasErrorPrefix checks if the err is a Redis error and the message contains a prefix. func HasErrorPrefix(err error, prefix string) bool { var rErr Error diff --git a/export_test.go b/export_test.go index 10d8f23ce5..c1b77683f3 100644 --- a/export_test.go +++ b/export_test.go @@ -11,8 +11,6 @@ import ( "github.com/redis/go-redis/v9/internal/pool" ) -var ErrPoolTimeout = pool.ErrPoolTimeout - func (c *baseClient) Pool() pool.Pooler { return c.connPool }