can we avoid this duplication between `session` and `try_connection`?