|
@@ -5,6 +5,7 @@ package com.fs.app.exception;
|
|
|
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
+import com.fs.common.exception.ServiceException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
@@ -36,6 +37,18 @@ public class FSExceptionHandler {
|
|
|
return r;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理自定义异常
|
|
|
+ */
|
|
|
+ @ExceptionHandler(ServiceException.class)
|
|
|
+ public R handleRRException(ServiceException e){
|
|
|
+ R r = new R();
|
|
|
+ r.put("code", e.getCode());
|
|
|
+ r.put("msg", e.getMessage());
|
|
|
+
|
|
|
+ return r;
|
|
|
+ }
|
|
|
+
|
|
|
@ExceptionHandler(NoHandlerFoundException.class)
|
|
|
public R handlerNoFoundException(Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|