Fix incorrect error messages when failing to connect
As noticed by @olasd in https://gitlab.softwareheritage.org/infra/sysadm-environment/-/issues/4679#note_13102
Migrated from D8877 (view on Phabricator)
As noticed by @olasd in https://gitlab.softwareheritage.org/infra/sysadm-environment/-/issues/4679#note_13102
Migrated from D8877 (view on Phabricator)