Get detail messages of chained exceptions Java

后端 未结 5 576
面向向阳花
面向向阳花 2020-12-28 16:29

I\'d like to know how I could I thorw a \"final\" Exception, containing a detail message with all the detail messages of a number of chained exceptions.

5条回答
  •  灰色年华
    2020-12-28 17:04

    you can better use it this way, merge the message() of previous Exception with the message() of new Exception you are throwing:

          } catch (Exception e) {
              throw new Exception("FIRST EXCEPTION" + e.getMessage(), e);
          }
    

提交回复
热议问题