New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GithubClient.Repository.GetAllLanguages throws Exception when the repo does not have a language #1820
Comments
Hi @baonguyen96 Can you provide the c# code that produced the error? The API link you provided (getting all repos for a user) doesn't correlate to the the stack trace. We definitely dont want an exception like this occurring, but I just want to get the repro code in this issue for completeness 👍 |
@ryangribble Sure here is the link to the source code: https://github.com/baonguyen96/GitData/blob/dev/GitData/Storage/Repository.cs Particularly, it breaks on line 41 ( IReadOnlyList<Octokit.RepositoryLanguage> languages = null;
Task.Run(async () =>
{
languages = await githubClient.Repository.GetAllLanguages(octokitRepository.Owner.Login, Name);
}).GetAwaiter().GetResult(); This exception does not happen when a repository has at least 1 language. |
@baonguyen96 can you please take a look at #1831 and let me know if that would suit your needs? Do you have a preference between returning an empty list or returning a |
@ryangribble yes I definitely prefer the empty list to null. Thank you. |
Example with this API endpoint: https://api.github.com/users/vinhhoa1/repos
Using the above code will crash with this error for repository RPG-ZombiesTCC:
I think it would be better if null value are marked as "" (empty) rather than throwing an exception here.
The text was updated successfully, but these errors were encountered: