Throw the proper exceptions when the connection can't be established