package pulley;

public class Result<T> {

    private final T value;
    private final Throwable throwable;

    public Result(T value, Throwable throwable) {
        this.value = value;
        this.throwable = throwable;
    }

    public static <T> Result<T> value(T t) {
        return new Result<T>(t, null);
    }

    public static <T> Result<T> error(Throwable throwable) {
        return new Result<T>(null, throwable);
    }

    public T value() {
        return value;
    }

    public Throwable error() {
        return throwable;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Result [value=");
        builder.append(value);
        builder.append(", throwable=");
        builder.append(throwable);
        builder.append("]");
        return builder.toString();
    }

}

@@ -542,24 +542,96 @@
 ble;%0A    %7D%0A%0A
+    public boolean isError() %7B%0A        return throwable != null;%0A    %7D%0A%0A
     @Overrid

add to Result