Handle network errors without losing data