Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

pool.on('error') Documentation Inaccurate #138

Open
jerroydmoore opened this issue Dec 5, 2019 · 0 comments
Open

pool.on('error') Documentation Inaccurate #138

jerroydmoore opened this issue Dec 5, 2019 · 0 comments

Comments

@jerroydmoore
Copy link

Greetings everyone,

I believe the documentation for pool.on('error') is inaccurate/incomplete.

The documentation directs users to "handle this in the same way you would treat process.on('uncaughtException')". The uncaughtException event discourages users from recovering the application: "Unhandled exceptions inherently mean that an application is in an undefined state. Attempting to resume application code without properly recovering from the exception can cause additional unforeseen and unpredictable issues."

After reading through brianc/node-postgres#1075 and brianc/node-postgres#1558. @charmander briefly mentions that pg.Pool will handle reconnecting pg.Client after restarting Postgres: "A pg.Pool will handle this for you, even if you never want more than one client."

Given that pg.Pool can recover from client errors, I think this should be included in the documentation about error handling.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant