mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
全局异常参数错误提示优化:业务异常中系统错误增加堆栈输出
This commit is contained in:
+5
@@ -251,7 +251,12 @@ public class GlobalExceptionHandler {
|
|||||||
*/
|
*/
|
||||||
@ExceptionHandler(value = ServiceException.class)
|
@ExceptionHandler(value = ServiceException.class)
|
||||||
public CommonResult serviceExceptionHandler(ServiceException ex) {
|
public CommonResult serviceExceptionHandler(ServiceException ex) {
|
||||||
|
// 系统异常输出堆栈
|
||||||
|
if(INTERNAL_SERVER_ERROR.getCode().equals(ex.getCode())) {
|
||||||
|
log.info("[serviceExceptionHandler]", ex);
|
||||||
|
} else {
|
||||||
log.info(String.format("==========[serviceExceptionHandler]==========,%s:%s", ex.getCode(), ex.getMessage()));
|
log.info(String.format("==========[serviceExceptionHandler]==========,%s:%s", ex.getCode(), ex.getMessage()));
|
||||||
|
}
|
||||||
return CommonResult.error(ex.getCode(), ex.getMessage());
|
return CommonResult.error(ex.getCode(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,12 @@ public class GlobalExceptionHandler implements ErrorWebExceptionHandler {
|
|||||||
|
|
||||||
@ExceptionHandler(value = ServiceException.class)
|
@ExceptionHandler(value = ServiceException.class)
|
||||||
public CommonResult serviceExceptionHandler(ServiceException ex) {
|
public CommonResult serviceExceptionHandler(ServiceException ex) {
|
||||||
log.info(String.format("========[serviceExceptionHandler]========,%s: %s", ex.getCode(),ex.getMessage()));
|
// 系统异常输出堆栈
|
||||||
|
if(INTERNAL_SERVER_ERROR.getCode().equals(ex.getCode())) {
|
||||||
|
log.info("[serviceExceptionHandler]", ex);
|
||||||
|
} else {
|
||||||
|
log.info(String.format("==========[serviceExceptionHandler]==========,%s:%s", ex.getCode(), ex.getMessage()));
|
||||||
|
}
|
||||||
return CommonResult.error(ex.getCode(), ex.getMessage());
|
return CommonResult.error(ex.getCode(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user