class TDPExceptionUtils {

    static TDPException processHystrixException(HystrixRuntimeException hre) {
        // filter out hystrix exception level if possible
        Throwable e = hre;
        TDPException innerMostTDPException = null;
        while (e.getCause() != null) {
            e = e.getCause();
            if (e instanceof TDPException) {
                innerMostTDPException = (TDPException) e;
            }
        }
        if (innerMostTDPException != null) {
            return innerMostTDPException;
        } else {
            return new TDPException(CommonErrorCodes.UNEXPECTED_SERVICE_EXCEPTION, hre);
        }
    }

    private  TDPExceptionUtils();

}