Download via Jitpack <repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependency> <groupId>com.github.Jadefalke256</groupId> <artifactId>Try-Catch-Wrapper</artifactId> <version>v1.0.1</version> </dependency> Usage Run method Try.attempt(this::executeMethod) .onCatch(Throwable::printStacktrace) .run(); Obtain value from method call var files = Try.attempt(() -> Files.list(path)) .onCatch(IOException.class, Throwable::printStacktrace) .obtain(); files.ifPresent(this::doSomething); Use finally Try.attempt(this::startProcess) .onFinally(this::endProcess); .run();