How do you approach error handling and state management in a distributed system where network connectivity is intermittent?