handle exception correctly, add some `Connection` tests