package com.nanyan.securitylink.interceptor; import com.nanyan.securitylink.execption.BaseException; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import com.nanyan.securitylink.vo.Response; @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(BaseException.class) public ResponseEntity<Response> businessException(BaseException e){ Response response = Response.getResponse(e.getCode(), e.getMessage()); return ResponseEntity.ok(response); } }