Fix exception handling in `Client_main.with_connection'`