Get failure exception in @HystrixCommand fallback method

后端 未结 5 1322
-上瘾入骨i
-上瘾入骨i 2020-12-28 08:21

Is there a way to get the reason a HystrixCommand failed when using the @HystrixCommand annotation within a Spring Boot application? It looks like

5条回答
  •  盖世英雄少女心
    2020-12-28 08:59

    Most of the time just using getFailedExecutionException().getMessage() gave me null values.

       Exception errorFromThrowable = getExceptionFromThrowable(getExecutionException());
       String errMessage = (errorFromThrowable != null) ? errorFromThrowable.getMessage()
    

    this gives me better results all the time.

提交回复
热议问题