We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0328cb3 commit c489cfeCopy full SHA for c489cfe
packages/pg-transaction/src/index.test.ts
@@ -147,4 +147,22 @@ describe('Transaction', () => {
147
assert.equal(rows.length, 1, 'Row should be visible after transaction with return value')
148
pool.end()
149
})
150
+
151
+ it('does not throw an uncatchable error if pool cannot connect', async () => {
152
+ const pool = new Pool({
153
+ connectionString: 'postgres://invalid:invalid@localhost:5432/invalid_db',
154
+ })
155
156
+ const promise = transaction(pool, async (client) => {
157
+ await client.query('SELECT 1')
158
159
160
+ try {
161
+ await assert.rejects(promise, {
162
+ name: 'error',
163
164
+ } finally {
165
+ await pool.end()
166
+ }
167
168
0 commit comments