开发者社区 > 云原生 > 正文

ex的cause是错的,应该是造成降级的异常信息

ex的cause是错的,应该是造成降级的异常信息

提问195.png

版本号1.6.3最新版

原提问者GitHub用户starry-eyed-art

展开
收起
码字王 2023-05-19 17:03:28 114 0
1 条回答
写回答
取消 提交回答
  • The BlockException does not carry a cause exception, so you cannot get the cause via getCause method. The self cause object is the default behaviour for JVM exceptions. See java.lang.Throwable#getCause:

    /** * Returns the cause of this throwable or {@code null} if the * cause is nonexistent or unknown. (The cause is the throwable that * caused this throwable to get thrown.) * *

    This implementation returns the cause that was supplied via one of * the constructors requiring a {@code Throwable}, or that was set after * creation with the {@link #initCause(Throwable)} method. While it is * typically unnecessary to override this method, a subclass can override * it to return a cause set by some other means. This is appropriate for * a "legacy chained throwable" that predates the addition of chained * exceptions to {@code Throwable}. Note that it is not * necessary to override any of the {@code PrintStackTrace} methods, * all of which invoke the {@code getCause} method to determine the * cause of a throwable. * * @return the cause of this throwable or {@code null} if the * cause is nonexistent or unknown. * @since 1.4 */ public synchronized Throwable getCause() { return (cause==this ? null : cause); }

    原回答者GitHub用户sczyh30

    2023-05-19 22:44:17
    赞同 展开评论 打赏
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载