java trywithresources:不允许自抑制
使用Jedis对一些数据进行排队,并出现以下错误消息:
java.lang.IllegalArgumentException: Self-suppression not permitted at java.lang.Throwable.addSuppressed(Throwable.java:1043)
有关区块:
try (Jedis jedis = pool.getResource()) {
... do things with redis
} catch(Exception exception) {
LOG.error("exception", exception);
}
try块中的某个东西抛出了一个异常,但我似乎无法得到消息,因为发生了这种“自我抑制”
有什么方法可以提取异常吗?这条消息告诉我什么
共 (0) 个答案