Browse Source

增加业务异常捕获

tags/v2.4.1
xiaoying 1 year ago
parent
commit
e068e4c1c9
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/common/ExceptionCatch.java

+ 12
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/common/ExceptionCatch.java View File

@@ -23,4 +23,16 @@ public class ExceptionCatch {
log.error("catch exception:{}",e.getMessage());
return JsonResult.error(e.getMessage());
}

/**
* 处理可控异常 自定义异常
* @param e
* @return
*/
@ExceptionHandler(ServiceException.class)
@ResponseBody
public JsonResult exception(ServiceException e){
log.error("catch exception:{}",e);
return JsonResult.error(e.getMessage());
}
}

Loading…
Cancel
Save