异常打印7
This commit is contained in:
@@ -144,35 +144,37 @@ public class CzgControllerAdvice {
|
|||||||
@ExceptionHandler(value = Exception.class)
|
@ExceptionHandler(value = Exception.class)
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public CzgResult<Object> errorHandler(Exception ex) {
|
public CzgResult<Object> errorHandler(Exception ex) {
|
||||||
// Throwable rootCause = ex;
|
Throwable rootCause = ex;
|
||||||
// while (rootCause.getCause() != null) {
|
log.info("rootCause2:{}", rootCause);
|
||||||
// rootCause = rootCause.getCause();
|
// 处理自定义异常
|
||||||
// if (rootCause instanceof CzgException czgException) {
|
if (rootCause instanceof CzgException czgException) {
|
||||||
// return CzgResult.failure(czgException.getCode(), czgException.getMessage());
|
return CzgResult.failure(czgException.getCode(), czgException.getMessage());
|
||||||
// }
|
}
|
||||||
// if (rootCause instanceof OrderValidateException orderValidateException) {
|
if (rootCause instanceof OrderValidateException orderValidateException) {
|
||||||
// return CzgResult.failure(orderValidateException.getCode(), orderValidateException.getMessage());
|
return CzgResult.failure(orderValidateException.getCode(), orderValidateException.getMessage());
|
||||||
// }
|
}
|
||||||
// if (rootCause instanceof PaySuccessException) {
|
if (rootCause instanceof OrderCancelException) {
|
||||||
// return CzgResult.failure(701, "订单已过期,请重新下单");
|
return CzgResult.failure(701, "订单已过期,请重新下单");
|
||||||
// }
|
}
|
||||||
// if (rootCause instanceof OrderCancelException) {
|
if (rootCause instanceof PaySuccessException) {
|
||||||
// return CzgResult.success("支付成功");
|
return CzgResult.success("支付成功");
|
||||||
// }
|
}
|
||||||
// }
|
while (rootCause.getCause() != null) {
|
||||||
// // 处理自定义异常
|
log.info("rootCause1:{}", rootCause);
|
||||||
// if (rootCause instanceof CzgException czgException) {
|
rootCause = rootCause.getCause();
|
||||||
// return CzgResult.failure(czgException.getCode(), czgException.getMessage());
|
if (rootCause instanceof CzgException czgException) {
|
||||||
// }
|
return CzgResult.failure(czgException.getCode(), czgException.getMessage());
|
||||||
// if (rootCause instanceof OrderValidateException orderValidateException) {
|
}
|
||||||
// return CzgResult.failure(orderValidateException.getCode(), orderValidateException.getMessage());
|
if (rootCause instanceof OrderValidateException orderValidateException) {
|
||||||
// }
|
return CzgResult.failure(orderValidateException.getCode(), orderValidateException.getMessage());
|
||||||
// if (rootCause instanceof OrderCancelException) {
|
}
|
||||||
// return CzgResult.failure(701, "订单已过期,请重新下单");
|
if (rootCause instanceof PaySuccessException) {
|
||||||
// }
|
return CzgResult.failure(701, "订单已过期,请重新下单");
|
||||||
// if (rootCause instanceof PaySuccessException) {
|
}
|
||||||
// return CzgResult.success("支付成功");
|
if (rootCause instanceof OrderCancelException) {
|
||||||
// }
|
return CzgResult.success("支付成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
setErrorLog(ex);
|
setErrorLog(ex);
|
||||||
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), ex.getMessage());
|
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user