java-gitlab-api
java-gitlab-api copied to clipboard
getGroups() throws java.lang.Error for token with insufficient scope
(Applies to v1.2.8 and current GitLab.com, 10.2.2).
Calling GitlabAPI.getGroups() when the instance of GitlabAPI was created with a token with insufficient scope (e.g. read_user) throws a java.lang.Error. Calling code needs to catch Throwable to ensure it catches the methods declared IOException and this potential error.
This scenario should throw a subclass of Exception (e.g. IOException or GitlabAPIException) rather than Error.
Error is thrown here https://github.com/timols/java-gitlab-api/blob/20d3c7dbac3a23909c2c3d84ee26bb45953b5e3b/src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java#L263