console/patches/slonik@30.4.4.patch
2024-03-18 09:28:44 +00:00

21 lines
925 B
Diff

diff --git a/dist/src/factories/createPool.js b/dist/src/factories/createPool.js
index b91a9fe433dc340f5cdf096ca4c568297c343ab3..401df1272d1c7f344bb956b38cc7dbde29231742 100644
--- a/dist/src/factories/createPool.js
+++ b/dist/src/factories/createPool.js
@@ -44,6 +44,16 @@ const createPool = async (connectionUri, clientConfigurationInput) => {
getTypeParser,
},
});
+
+ // https://github.com/gajus/slonik/issues/471
+ // https://github.com/brianc/node-postgres/issues/2764#issuecomment-1163475426
+ // Slonik did not have a way to handle errors emitted by the pool, which resulted in an uncaught exception, which would crash the process.
+ pool.on('error', (error) => {
+ poolLog.error({
+ error: (0, serialize_error_1.serializeError)(error),
+ }, 'client error');
+ });
+
state_1.poolStateMap.set(pool, {
ended: false,
mock: false,