Skip to content

Commit cef1de1

Browse files
committed
Use more helpful pool-lacking-error-handlers errors
1 parent bcf9a87 commit cef1de1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,17 @@ export async function assertPool(
300300
pgPool = _rawOptions.pgPool;
301301
if (pgPool.listeners("error").length === 0) {
302302
console.warn(
303-
`Your pool doesn't have error handlers! See: https://err.red/wpeh`,
303+
`Your pool doesn't have error handlers! See: https://err.red/wpeh?v=${encodeURIComponent(
304+
version,
305+
)}`,
306+
);
307+
installErrorHandlers(compiledSharedOptions, releasers, pgPool);
308+
}
309+
if (pgPool.listeners("connect").length === 0) {
310+
console.warn(
311+
`Your pool doesn't have all of the error handlers! See: https://err.red/wpeh?v=${encodeURIComponent(
312+
version,
313+
)}&method=connect`,
304314
);
305315
installErrorHandlers(compiledSharedOptions, releasers, pgPool);
306316
}

0 commit comments

Comments
 (0)