Handle network errors gracefully.