catch exceptions on connection problems