LocalGitDBImpl.branch: rewrite without try/catch block
This commit is contained in:
parent
32027ef6e1
commit
436a3e2501
1 changed files with 3 additions and 7 deletions
|
@ -112,13 +112,9 @@ final class LocalGitDBImpl implements GitDB, LocalGitDB {
|
|||
|
||||
@Override
|
||||
public Result<Maybe<GitDBBranch>> branch(final String name) {
|
||||
try {
|
||||
return Result.invert(Maybe.maybe(
|
||||
repository.findRef(name))
|
||||
.map(branchInit::apply));
|
||||
} catch (IOException e) {
|
||||
return Result.error(e);
|
||||
}
|
||||
return Result.maybeThen(
|
||||
Result.of(() -> Maybe.maybe(repository.findRef(name))),
|
||||
refMaybe -> Result.invert(refMaybe.map(branchInit)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue