Skip to content

Commit 60b4529

Browse files
committed
Pool: raise custom error when DB::PoolTimeout
1 parent e5795ca commit 60b4529

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/invidious/connection/pool.cr

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module Invidious::ConnectionPool
7272
response = yield http_client
7373
rescue ex : DB::PoolTimeout
7474
# Failed to checkout a client
75-
raise ConnectionPool::Error.new(ex.message, cause: ex)
75+
raise ConnectionPool::PoolCheckoutError.new(ex.message)
7676
rescue ex
7777
# An error occurred with the client itself.
7878
# Delete the client from the pool and close the connection
@@ -131,6 +131,10 @@ module Invidious::ConnectionPool
131131
class Error < Exception
132132
end
133133

134+
# Raised when the pool failed to get a client in time
135+
class PoolCheckoutError < Error
136+
end
137+
134138
# Mapping of subdomain => Invidious::ConnectionPool::Pool
135139
# This is needed as we may need to access arbitrary subdomains of ytimg
136140
private YTIMG_POOLS = {} of String => ConnectionPool::Pool

0 commit comments

Comments
 (0)