Skip to content

Commit

Permalink
Remove redundant exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Feb 23, 2024
1 parent 98d1c33 commit d5431b1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/fr/igred/omero/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -373,25 +374,22 @@ public GroupWrapper getGroup(long groupId)


/**
* Returns all the groups on the OMERO database (for admins only)
* Returns all the groups on OMERO.
*
* @return The list of groups on OMERO.
* @return See above.
*
* @throws ServiceException Cannot connect to OMERO.
* @throws AccessException Cannot access data.
* @throws NoSuchElementException The requested group cannot be found.
*/
public List<GroupWrapper> getGroups()
throws ServiceException, AccessException {
String error = "Cannot retrieve the groups on OMERO";
return ExceptionHandler.of(getGateway(),
g -> g.getAdminService(getCtx()).lookupGroups())
.rethrow(ApiUsageException.class,
(m, e) -> new NoSuchElementException(m),
"Groups not found")
.handleOMEROException(error)
.get()
.stream()
.filter(Objects::nonNull)
.map(GroupData::new)
.map(GroupWrapper::new)
.collect(Collectors.toList());
Expand Down

0 comments on commit d5431b1

Please sign in to comment.