After the springAOP is called by rpc, the returned parameters are judged. If there is a problem, it can be returned to controller, directly. No problem to continue execution.

what I want to do is that if an error is returned directly through the section, if there is no error code, continue to execute

Mar.30,2021

for error exceptions, you can define different project custom exceptions, such as AOP check exception, Token check exception, project global exception, etc.
capture it through Handler and return the data required by the corresponding format.

I define a global and a check exception

in the following code
@Getter
public class SbException extends RuntimeException {

    private Integer code;

    public SbException(ResultEnum resultEnum){
        super(resultEnum.getMessage());

        this.code = resultEnum.getCode();
    }

    public SbException(Integer code, String message){
        super(message);

        this.code = code;
    }
}

public class SbAuthorizeException extends RuntimeException {

}

then define handler

@ControllerAdvice
public class SbExceptionHandler {

    @Autowired
    private ProjectUrlConfig projectUrlConfig;

    //
    @ExceptionHandler(value = SbAuthorizeException.class)
    @ResponseStatus(HttpStatus.FORBIDDEN)
    public ModelAndView handlerAuthorizeException(){
        return new ModelAndView("redirect:"
                .concat(projectUrlConfig.getWechatOpenAuthorize())
                .concat("/sb/wechat/qrAuthorize")
                .concat("?returnUrl=")
                .concat(projectUrlConfig.getSb())
                .concat("/sb/seller/login"));
    }

    //
    @ExceptionHandler(value = SbException.class)
    @ResponseBody
    public ResultVO handlerSbException(SbException e){
        return ResultVOUtil.error(e.getCode(),e.getMessage());
    }

    // Http
    @ExceptionHandler(value = ResponseBankException.class)
    @ResponseStatus(HttpStatus.FORBIDDEN)//403
    public void handleResponseBankException(){

    }

    //
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public ResultVO handlerException(Exception e){
        return ResultVOUtil.error(666,e.getMessage());
    }

}

in this way, you only need to throw the corresponding exception in the corresponding place or when the business execution error occurs

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35d84-2bfcf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35d84-2bfcf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?