【发布时间】:2019-12-12 11:40:34
【问题描述】:
这是我遇到问题的代码:
try {
publisher.publish(payload).get();
} catch (com.google.api.gax.rpc.DeadlineExceededException e) {
LOGGER.error("com.google.api.gax.rpc.DeadlineExceededException occured: " + e.getCause());
} catch (com.google.api.gax.rpc.NotFoundException e) {
LOGGER.error("com.google.api.gax.rpc.NotFoundException occured: " + e.getCause());
} catch (com.google.api.gax.rpc.ApiException e) {
LOGGER.error("com.google.api.gax.rpc.ApiException occured: " + e.getCause());
} catch (io.grpc.StatusRuntimeException e) {
LOGGER.error("io.grpc.StatusRuntimeException occured: " + e.getCause());
} catch (java.lang.RuntimeException e) {
LOGGER.error("RuntimeException occured: " + e.getCause());
} catch (java.util.concurrent.ExecutionException e) {
LOGGER.error("java.util.concurrent.ExecutionException occured: " + e.getCause()); // my program cursor always come to this point
} catch (Exception e) {
LOGGER.error("Exception occured: " + e.getCause());
}
而 ExecutionException catch 的 getCause 是:
java.util.concurrent.ExecutionException 发生: com.google.api.gax.rpc.NotFoundException: io.grpc.StatusRuntimeException: NOT_FOUND: 找不到资源
如果您看到我已经将“com.google.api.gax.rpc.NotFoundException”的捕获放在第二个捕获中,那么为什么它进入了 ExcutionException 捕获。
由于这种性质,我无法为客户编写适当的消息来解决。
如果有人可以提供帮助,请提前致谢。
【问题讨论】:
标签: spring-boot exception exceptionhandler