From 4586baea27f4d01138a10caeaa49b02e6cf4143a Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 24 Jun 2014 10:38:13 -0400 Subject: [PATCH] Explain what a FNFE from delete() may just mean your token is lacking delete_repo. --- src/main/java/org/kohsuke/github/GHRepository.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 294347b596..d5533dab7a 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -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; @@ -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); + } } /**