Add network error handling to API request