package com.ruoyi.web.handler; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.web.exception.ErrorMessageException; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; @ControllerAdvice @Slf4j public class ErrorMessageExceptionHandler { @ExceptionHandler(value = ErrorMessageException.class) @ResponseBody public AjaxResult handlerErrorMessageException(ErrorMessageException e) { return AjaxResult.error(e.getCode(),e.getMessage()); } }