Skip to content

Commit

Permalink
Merge pull request #102 from jglick/clearer-FNFE
Browse files Browse the repository at this point in the history
Better FNFE from delete()
  • Loading branch information
kohsuke committed Jul 3, 2014
2 parents 219916e + 4586bae commit d2c9095
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit d2c9095

Please sign in to comment.