Replace "new Error" with GHException

(rolled back some of the hunks from the original PR)
This commit is contained in:
Björn Häuser
2017-11-20 21:36:00 +01:00
committed by Kohsuke Kawaguchi
parent e25ae27a15
commit d0b4652dcd
2 changed files with 12 additions and 15 deletions

View File

@@ -103,7 +103,7 @@ public class GHGist extends GHObject {
* Used when caller obtains {@link GHGist} without knowing its owner.
* A partially constructed owner object is interned.
*/
/*package*/ GHGist wrapUp(GitHub root) throws IOException {
/*package*/ GHGist wrapUp(GitHub root) {
this.owner = root.getUser(owner);
this.root = root;
wrapUp();
@@ -144,12 +144,8 @@ public class GHGist extends GHObject {
return new PagedIterator<GHGist>(root.retrieve().asIterator(getApiTailUrl("forks"), GHGist[].class, pageSize)) {
@Override
protected void wrapUp(GHGist[] page) {
try {
for (GHGist c : page)
c.wrapUp(root);
} catch (IOException e) {
throw new Error(e);
}
for (GHGist c : page)
c.wrapUp(root);
}
};
}

View File

@@ -54,16 +54,17 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
import static java.util.Arrays.*;
import static java.util.logging.Level.*;
import static org.apache.commons.lang.StringUtils.*;
import static org.kohsuke.github.GitHub.*;
import static java.util.Arrays.asList;
import static java.util.logging.Level.FINE;
import static java.util.logging.Level.FINEST;
import static java.util.logging.Level.INFO;
import static org.apache.commons.lang.StringUtils.defaultString;
import static org.kohsuke.github.GitHub.MAPPER;
/**
* A builder pattern for making HTTP call and parsing its output.
@@ -451,8 +452,8 @@ class Requester {
try {
return new PagingIterator<T>(type, tailApiUrl, root.getApiURL(s.toString()));
} catch (IOException e) {
throw new Error(e);
} catch (MalformedURLException e) {
throw new GHException("Unable to build github Api URL",e);
}
}
@@ -513,7 +514,7 @@ class Requester {
}
}
} catch (IOException e) {
throw new Error(e);
throw new GHException(e);
}
}