File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,12 @@ export const init: (config: PoolConfig) => {
115
115
}
116
116
return { data : res . rows , error : null }
117
117
} catch ( error : any ) {
118
- if ( error . constructor . name === 'DatabaseError' ) {
118
+ if (
119
+ error . constructor . name === 'DatabaseError' &&
120
+ // If that's a global packet handling error it's raised as a "DatabaseError" but really is a
121
+ // underlying parser error, we want to error to be treated as a connection error and end the pool
122
+ ! ( error . message && error . message . startsWith ( 'exception received while handling packet' ) )
123
+ ) {
119
124
// Roughly based on:
120
125
// - https://github.com/postgres/postgres/blob/fc4089f3c65a5f1b413a3299ba02b66a8e5e37d0/src/interfaces/libpq/fe-protocol3.c#L1018
121
126
// - https://github.com/brianc/node-postgres/blob/b1a8947738ce0af004cb926f79829bb2abc64aa6/packages/pg/lib/native/query.js#L33
You can’t perform that action at this time.
0 commit comments