handle connection exception and call callback