throwing exception on connection error