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 handleCustomException(BaseException baseException) { return ResultTemplate.error(baseException.getCode(),baseException.getMessage(),baseException.getData()); } }