Skip to content

Commit 87b0943

Browse files
committed
Fix some errors not throwing for current query
1 parent d342c12 commit 87b0943

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/connection.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ function Connection(options = {}) {
9797
}
9898

9999
function destroy() {
100-
const err = errors.connection('DESTROYED', options)
101-
backend.query && backend.query.reject(err)
102-
error(err)
100+
error(errors.connection('DESTROYED', options))
103101
socket.destroy()
104102
}
105103

106104
function error(err) {
105+
backend.query && backend.query.reject(err)
107106
let q
108107
while ((q = queries.shift()))
109108
q.reject(err)

lib/frontend.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const bytes = require('./bytes.js')
33
const { errors, entries } = require('./types.js')
44

55
const N = String.fromCharCode(0)
6+
const empty = Buffer.alloc(0)
67
const execute = Buffer.concat([
78
bytes.D().str('P').str(N).end(),
89
bytes.E().str(N).i32(0).end(),
@@ -126,7 +127,7 @@ function SASLContinue(type, x, options, pass) {
126127

127128
function SASLFinal(type, x, options) {
128129
if (x.toString('utf8', 9).split(N, 1)[0].slice(2) === options.serverSignature)
129-
return ''
130+
return empty
130131
/* c8 ignore next 4 */
131132
throw errors.generic({
132133
message: 'The server did not return the correct signature',

0 commit comments

Comments
 (0)