-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ServiceDownException for case GitHub's API is down (#1813)
* Implement ServiceDownException for case GitHub's API is down * Update src/main/java/org/kohsuke/github/GitHubConnectorResponseErrorHandler.java * Update src/main/java/org/kohsuke/github/GitHubConnectorResponseErrorHandler.java * Apply suggestions from code review * Update src/main/java/org/kohsuke/github/ServiceDownException.java --------- Co-authored-by: Liam Newman <[email protected]>
- Loading branch information
1 parent
eb269bd
commit af19581
Showing
8 changed files
with
620 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/org/kohsuke/github/ServiceDownException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.kohsuke.github; | ||
|
||
import org.kohsuke.github.connector.GitHubConnectorResponse; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Special {@link IOException} case for http exceptions, when {@link HttpException} is thrown due to GitHub service | ||
* being down. | ||
* | ||
* Inherits from {@link HttpException} to maintain compatibility with existing clients. | ||
* | ||
* @author <a href="mailto:[email protected]">Rastislav Budinsky</a> | ||
*/ | ||
public class ServiceDownException extends HttpException { | ||
|
||
/** | ||
* Instantiates a new service down exception. | ||
* | ||
* @param connectorResponse | ||
* the connector response to base this on | ||
*/ | ||
public ServiceDownException(GitHubConnectorResponse connectorResponse) { | ||
super(connectorResponse); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
.../org/kohsuke/github/GitHubTest/wiremock/testCatchServiceDownException/__files/1-user.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"login": "The-Huginn", | ||
"id": 78657734, | ||
"node_id": "MDQ6VXNlcjc4NjU3NzM0", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/78657734?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/The-Huginn", | ||
"html_url": "https://github.com/The-Huginn", | ||
"followers_url": "https://api.github.com/users/The-Huginn/followers", | ||
"following_url": "https://api.github.com/users/The-Huginn/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/The-Huginn/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/The-Huginn/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/The-Huginn/subscriptions", | ||
"organizations_url": "https://api.github.com/users/The-Huginn/orgs", | ||
"repos_url": "https://api.github.com/users/The-Huginn/repos", | ||
"events_url": "https://api.github.com/users/The-Huginn/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/The-Huginn/received_events", | ||
"type": "User", | ||
"site_admin": false, | ||
"name": "Rastislav Budinsky", | ||
"company": "Red Hat", | ||
"blog": "thehuginn.com", | ||
"location": null, | ||
"email": null, | ||
"hireable": null, | ||
"bio": null, | ||
"twitter_username": "The_Hug1nn", | ||
"public_repos": 47, | ||
"public_gists": 0, | ||
"followers": 3, | ||
"following": 2, | ||
"created_at": "2021-02-06T17:33:36Z", | ||
"updated_at": "2024-03-11T08:56:45Z" | ||
} |
Oops, something went wrong.