```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;
    }
```
```
if (listener != null) {
                            listener.onResponse(r, filterInvoker, invocation);
                        }
                    } else {
                        filter.onResponse(r, filterInvoker, invocation);
                    }
                }
                return r;
            });
            return asyncResult;
        }
        @Override
        public Class<T> getInterface() {
            return filterInvoker.getInterface();
        }
        @Override
        public URL getUrl() {
            return filterInvoker.getUrl();
        }
        @Override
        public boolean isAvailable() {
            return filterInvoker.isAvailable();
        }
        @Override
        public void destroy() {
            filterInvoker.destroy();
        }
    }
}