Skip to content

Commit

Permalink
Merge pull request #169 from KostyaSha/fixAuthLoop
Browse files Browse the repository at this point in the history
Throw error for bad creds
  • Loading branch information
kohsuke committed Apr 13, 2015
2 parents 7ff9734 + d0d0716 commit aad20d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/kohsuke/github/Requester.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ private InputStream wrapStream(InputStream in) throws IOException {
* Handle API error by either throwing it or by returning normally to retry.
*/
/*package*/ void handleApiError(IOException e) throws IOException {
if (uc.getResponseCode() == 401) // Unauthorized == bad creds
throw e;

if ("0".equals(uc.getHeaderField("X-RateLimit-Remaining"))) {
root.rateLimitHandler.onError(e,uc);
}
Expand Down

0 comments on commit aad20d0

Please sign in to comment.