copy to: manage error in 1 point
This commit is contained in:
parent
1dac5355d1
commit
e39a9b2bf7
@ -89,17 +89,10 @@ function handleCopyTo (logger) {
|
|||||||
.on('close', () => {
|
.on('close', () => {
|
||||||
const err = new Error('Connection closed by client');
|
const err = new Error('Connection closed by client');
|
||||||
pgstream.emit('cancelQuery', err);
|
pgstream.emit('cancelQuery', err);
|
||||||
|
pgstream.emit('error', err);
|
||||||
metrics.end(null, err);
|
|
||||||
pgstream.unpipe();
|
|
||||||
|
|
||||||
return next(err);
|
|
||||||
})
|
})
|
||||||
.on('error', err => {
|
.on('error', err => {
|
||||||
metrics.end(null, err);
|
pgstream.emit('error', err);
|
||||||
pgstream.unpipe();
|
|
||||||
|
|
||||||
return next(err);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user