Internal API calls, ways in which all kinds of case have thrown exceptions, or ways in which values are returned
when the company calls the external interface, it will throw the wrong case abnormal way for the upper service,catch to deal with accordingly. For example:
Result result = service.invoke();
if(result= 1){
thow ServiceException();//
}
A large number of code styles are like this, but if the wrong case has been thrown to the upper layer in an abnormal way, if the upper layer needs some information about the returned result at that time to handle the exception, the upper layer can only put the returned result object in the exception, and the upper layer can only catch the exception. It is strange to get the return result from the exception and deal with it. How do we handle it or how do we treat it in this way