// Path: futuristic-core/src/main/java/io/futuristic/function/ConsumerWithException.java
// public interface ConsumerWithException<T> {
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param t the input argument
//      */
//     void accept(T t) throws Exception;
// }
// 
// Path: futuristic-core/src/main/java/io/futuristic/function/ExceptionTrapper.java
// public interface ExceptionTrapper<E extends Exception, R> {
// 
//     R trap(E exception) throws Exception;
// 
// }
// 
// Path: futuristic-core/src/main/java/io/futuristic/function/FunctionWithException.java
// public interface FunctionWithException<T, R> {
// 
//     /**
//      * Applies this function to the given argument.
//      *
//      * @param t the function argument
//      * @return the function result
//      */
//     R apply(T t) throws Exception;
// }


import io.futuristic.function.ConsumerWithException;
import io.futuristic.function.ExceptionTrapper;
import io.futuristic.function.FunctionWithException;
            return new FutureWithException<>(ex);
        }
    }

    @Override
    public <R> Future<R> map(FunctionWithException<T, R> mapper) {
        try {
            R mapped = mapper.apply(value);
            return new FutureWithValue<>(mapped);
        } catch (Exception ex) {
            return new FutureWithException<>(ex);
        }
    }

    @Override
    public <R> Future<R> mapFuture(FunctionWithException<T, Future<R>> mapper) {
        try {
            Future<R> mapped = mapper.apply(value);
            return mapped;
        } catch (Exception ex) {
            return new FutureWithException<>(ex);
        }
    }

    @Override
    public <E extends Exception> Future<T> trap(Class<E> exceptionClass, ExceptionTrapper<E, T> trapper) {
        return this;
    }

    @Override
// Path: futuristic-core/src/main/java/io/futuristic/function/ConsumerWithException.java
// public interface ConsumerWithException<T> {
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param t the input argument
//      */
//     void accept(T t) throws Exception;
// }
// 
// Path: futuristic-core/src/main/java/io/futuristic/function/ExceptionTrapper.java
// public interface ExceptionTrapper<E extends Exception, R> {
// 
//     R trap(E exception) throws Exception;
// 
// }
// 
// Path: futuristic-core/src/main/java/io/futuristic/function/FunctionWithException.java
// public interface FunctionWithException<T, R> {
// 
//     /**
//      * Applies this function to the given argument.
//      *
//      * @param t the function argument
//      * @return the function result
//      */
//     R apply(T t) throws Exception;
// }


// Path: futuristic-core/src/main/java/io/futuristic/FutureWithValue.java
import io.futuristic.function.ConsumerWithException;
import io.futuristic.function.ExceptionTrapper;
import io.futuristic.function.FunctionWithException;

            return new FutureWithException<>(ex);
        }
    }

    @Override
    public <R> Future<R> map(FunctionWithException<T, R> mapper) {
        try {
            R mapped = mapper.apply(value);
            return new FutureWithValue<>(mapped);
        } catch (Exception ex) {
            return new FutureWithException<>(ex);
        }
    }

    @Override
    public <R> Future<R> mapFuture(FunctionWithException<T, Future<R>> mapper) {
        try {
            Future<R> mapped = mapper.apply(value);
            return mapped;
        } catch (Exception ex) {
            return new FutureWithException<>(ex);
        }
    }

    @Override
    public <E extends Exception> Future<T> trap(Class<E> exceptionClass, ExceptionTrapper<E, T> trapper) {
        return this;
    }

    @Override
    public <E extends Exception> Future<T> trapFuture(Class<E> exceptionClass, ExceptionTrapper<E, Future<T>> trapper) {