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."
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 https://github.com/brianc/node-postgres/issues/1075 and https://github.com/brianc/node-postgres/issues/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.