123456789101112131415161718192021222324 |
- package com.shs.official.common.exception;
- import com.shs.official.common.template.ResultTemplate;
- import org.springframework.web.bind.annotation.ControllerAdvice;
- import org.springframework.web.bind.annotation.ExceptionHandler;
- import org.springframework.web.bind.annotation.ResponseBody;
- import java.util.Map;
- /**
- * 全局异常
- *
- * @author SHS
- */
- @ControllerAdvice
- public class GlobalExceptionHandler {
- @ResponseBody
- @ExceptionHandler(BaseException.class)
- public Map<String, Object> handleCustomException(BaseException baseException) {
- return ResultTemplate.error(baseException.getCode(),baseException.getMessage(),baseException.getData());
- }
- }
|