db_utils: Make connect_to_conninfo use through contextmanager
This allows to reduce the boilerplate regarding initial connection failures.
While trying to figure out the type issue, i tampered with this a bit ¯_(ツ)_/¯.
Test Plan
tests should still be happy
Migrated from D7644 (view on Phabricator)