From fa55a2b44a1f7d04bd80c9768564f15219d1769d Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Wed, 24 Apr 2024 21:50:02 +0800 Subject: [PATCH] log pg client errors --- src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.ts b/src/index.ts index d96fa0a2..01bdde60 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,6 +63,12 @@ function createPgPool(args: { url: string; logger: Logger }): pg.Pool { args.logger.error({ err, url: args.url }, "Postgres pool error"); }); + pool.on("connect", (client) => { + client.on("error", (err) => { + args.logger.error({ err, url: args.url }, "Postgres client error"); + }); + }); + return pool; }