package org.zwobble.mammoth.internal.util; import java.io.IOException; public class PassThroughException extends RuntimeException { public static T wrap(SupplierWithException supplier) { try { return supplier.get(); } catch (IOException exception) { throw new PassThroughException(exception); } } public static T unwrap(SupplierWithException supplier) throws IOException { try { return supplier.get(); } catch (PassThroughException exception) { throw exception.exception; } } private final IOException exception; public PassThroughException(IOException exception) { super(exception); this.exception = exception; } }