Add simulate network error for unit testing.