Because query and client both have logic they need to run, in order, after the user's callback, they are vulnerable to exceptions thrown from those callbacks. This change catches any exception thrown from user code and saves it until all necessary pg logic is complete before throwing again.
Yes, it's true that in production you should probably just restart the process if you have a top-level unhandled exception (that's what I do in production), but this is still a major pain for testing at the very least. And the existing behavior certainly prevents any kind of final app failover logic from hitting the database.
node test/integration/callback-crash-test.js <connectionString> can be run to verify that the changes work. Because all test frameworks install their own top-level uncaught exception handlers, this had to be a standalone file.