Helper to handle general and networking errors