Skip to content

Commit 774c7a1

Browse files
committed
Fix error messages when first starting up
1 parent 4baef5e commit 774c7a1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

deno/src/connection.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
388388
}
389389

390390
function queryError(query, err) {
391-
Object.defineProperties(err, {
391+
if (typeof query !== 'object') throw err
392+
393+
'query' in err || 'parameters' in err || Object.defineProperties(err, {
392394
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
393395
query: { value: query.string, enumerable: options.debug },
394396
parameters: { value: query.parameters, enumerable: options.debug },

src/connection.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
385385
}
386386

387387
function queryError(query, err) {
388+
if (typeof query !== 'object') throw err
389+
388390
'query' in err || 'parameters' in err || Object.defineProperties(err, {
389391
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
390392
query: { value: query.string, enumerable: options.debug },

0 commit comments

Comments
 (0)