Java Play Framework处理异常时获取执行上下文

时间:2019-07-11 08:41:03

标签: java playframework

在处理异常时如何获取上下文?

promise.thenApplyAsync(
    result -> {
        // do something
    }, ec.current()
).exceptionally(
    throwable -> {
        //how to get current execution context here? 
    }
);

如果我在异常代码中执行ctx().id(),则会收到错误消息java.util.concurrent.CompletionException: java.lang.RuntimeException: There is no HTTP Context available from here.

0 个答案:

没有答案