(related to #1735)
I think parseN/parseE are broken
|
// same thing, different name |
|
Connection.prototype.parseN = function (buffer, length) { |
|
var msg = this.parseE(buffer, length) |
|
msg.name = 'notice' |
|
return msg |
|
} |
|
// parses error |
|
Connection.prototype.parseE = function (buffer, length) { |
|
var fields = {} |
|
var msg, item |
|
var input = new Message('error', length) |
|
var fieldType = this.readString(buffer, 1) |
|
while (fieldType !== '\0') { |
|
fields[fieldType] = this.parseCString(buffer) |
|
fieldType = this.readString(buffer, 1) |
|
} |
|
if (input.name === 'error') { |
|
// the msg is an Error instance |
|
msg = new Error(fields.M) |
It looks like the one should create a Message and the other should create an Error, depending on the .name. However, parseE does always construct the input message with .name === 'error', so the else path is never hit.
(related to #1735)
I think
parseN/parseEare brokennode-postgres/lib/connection.js
Lines 635 to 640 in e4578d2
node-postgres/lib/connection.js
Lines 592 to 604 in e4578d2
It looks like the one should create a
Messageand the other should create anError, depending on the.name. However,parseEdoes always construct theinputmessage with.name === 'error', so theelsepath is never hit.