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
|
@Override
|
||||||
public Result<Maybe<GitDBBranch>> branch(final String name) {
|
public Result<Maybe<GitDBBranch>> branch(final String name) {
|
||||||
try {
|
return Result.maybeThen(
|
||||||
return Result.invert(Maybe.maybe(
|
Result.of(() -> Maybe.maybe(repository.findRef(name))),
|
||||||
repository.findRef(name))
|
refMaybe -> Result.invert(refMaybe.map(branchInit)));
|
||||||
.map(branchInit::apply));
|
|
||||||
} catch (IOException e) {
|
|
||||||
return Result.error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue