Skip to content

Commit

Permalink
Custom NetKAN error message for GitHub API rate limit violations
Browse files Browse the repository at this point in the history
  • Loading branch information
DasSkelett committed Oct 25, 2019
1 parent c234b25 commit b966804
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Netkan/Sources/Github/GithubApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ private string Call(string path)
{
return _http.DownloadText(url, _oauthToken);
}
catch (WebException webEx)
catch (NativeAndCurlDownloadFailedKraken k)
{
Log.ErrorFormat("WebException while accessing {0}: {1}", url, webEx);
if (k.responseStatus == 403 && k.responseHeader.Contains("X-RateLimit-Remaining: 0"))
{
throw new Kraken("GitHub API rate limit exceeded.");
}
throw;
}
}
Expand Down

0 comments on commit b966804

Please sign in to comment.