异常打印5
This commit is contained in:
parent
5141c019cd
commit
4e90ca4362
|
|
@ -144,36 +144,35 @@ 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) {
|
// while (rootCause.getCause() != null) {
|
||||||
log.info("rootCause:{}", rootCause.getClass());
|
// rootCause = rootCause.getCause();
|
||||||
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 PaySuccessException) {
|
// return CzgResult.failure(701, "订单已过期,请重新下单");
|
||||||
return CzgResult.failure(701, "订单已过期,请重新下单");
|
// }
|
||||||
}
|
// if (rootCause instanceof OrderCancelException) {
|
||||||
if (rootCause instanceof OrderCancelException) {
|
// return CzgResult.success("支付成功");
|
||||||
return CzgResult.success("支付成功");
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// // 处理自定义异常
|
||||||
// 处理自定义异常
|
// 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 OrderCancelException) {
|
||||||
if (rootCause instanceof OrderCancelException) {
|
// return CzgResult.failure(701, "订单已过期,请重新下单");
|
||||||
return CzgResult.failure(701, "订单已过期,请重新下单");
|
// }
|
||||||
}
|
// if (rootCause instanceof PaySuccessException) {
|
||||||
if (rootCause instanceof PaySuccessException) {
|
// return CzgResult.success("支付成功");
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue