```java
 public Result thenApplyWithContext(Function<Result, Result> fn) {
        this.thenApply(fn.compose(beforeContext).andThen(afterContext));
        // You may need to return a new Result instance representing the next async stage,
        // like thenApply will return a new CompletableFuture.
        return this;
    }
```

to

```java
```java
 public Result thenApplyWithContext(BiFunction<Throwable, Result> fn) {
        this.handle(fn);
        // You may need to return a new Result instance representing the next async stage,
        // like thenApply will return a new CompletableFuture.
        return this;
    }
```
```
public Object recreate() throws Throwable {
            return delegate.recreate();
        }
        @Override
        public Map<String, String> getAttachments() {
            return delegate.getAttachments();
        }
        @Override
        public void addAttachments(Map<String, String> map) {
            delegate.addAttachments(map);
        }
        @Override
        public void setAttachments(Map<String, String> map) {
            delegate.setAttachments(map);
        }
        @Override
        public String getAttachment(String key) {
            return delegate.getAttachment(key);
        }
        @Override
        public String getAttachment(String key, String defaultValue) {
            return delegate.getAttachment(key, defaultValue);
        }
        @Override
        public void setAttachment(String key, String value) {
            delegate.setAttachment(key, value);
        }
    }
}