-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Currently only the following stack trace is printed when the connection fails
{projectBasePath}/node_modules/jugglingdb-postgres/lib/postgres.js:419
data.forEach(function(field){
^
TypeError: Cannot read property 'forEach' of undefined
at decoratedCallback ({projectBasePath}/node_modules/jugglingdb-postgres/lib/postgres.js:419:13)
at {projectBasePath}/node_modules/jugglingdb-postgres/lib/postgres.js:64:20
at {projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/pool.js:75:25
at {projectBasePath}/node_modules/jugglingdb-postgres/node_modules/generic-pool/lib/generic-pool.js:274:11
at {projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/pool.js:27:26
at null.<anonymous> ({projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/client.js:181:5)
at emitOne (events.js:77:13)/
at emit (events.js:169:7)
at Socket.<anonymous> ({projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:59:10)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1269:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
At that point in the code (postgres.js:419) an error object is available and should be used to convey errors to the user.
Same goes if the connection is suddenly broken it will print the following error and crash the app:
events.js:141
throw er; // Unhandled 'error' event
^
error: terminating connection due to administrator command
at Connection.parseE ({projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:534:11)
at Connection.parseMessage ({projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:361:17)
at Socket.<anonymous> ({projectBasePath}/node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:105:22)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:153:18)
at Socket.Readable.push (_stream_readable.js:111:10)
at TCP.onread (net.js:536:20)
I suggest providing a more stable way of dealing with errors, such as a number of connection retries followed by a graceful error message if the retries fail.
Metadata
Metadata
Assignees
Labels
No labels