mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
fixed the behaviour in case the repository doesn't exist.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@@ -31,8 +32,17 @@ public abstract class GHPerson {
|
||||
return Collections.unmodifiableMap(repositories);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* null if the repository was not found
|
||||
*/
|
||||
public GHRepository getRepository(String name) throws IOException {
|
||||
return root.retrieve3("/repos/" + login + '/' + name, GHRepository.class).wrap(root);
|
||||
try {
|
||||
return root.retrieve3("/repos/" + login + '/' + name, GHRepository.class).wrap(root);
|
||||
} catch (FileNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user