Skip to content
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

Better FNFE from delete() #102

Merged
merged 1 commit into from
Jul 3, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import java.io.FileNotFoundException;

import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
Expand Down Expand Up @@ -416,7 +417,11 @@ public void setHomepage(String value) throws IOException {
* Deletes this repository.
*/
public void delete() throws IOException {
new Requester(root).method("DELETE").to("/repos/" + owner.login + "/" + name);
try {
new Requester(root).method("DELETE").to("/repos/" + owner.login + "/" + name);
} catch (FileNotFoundException x) {
throw (FileNotFoundException) new FileNotFoundException("Failed to delete " + owner.login + "/" + name + "; might not exist, or you might need the delete_repo scope in your token: http://stackoverflow.com/a/19327004/12916").initCause(x);
}
}

/**
Expand Down