26 lines
739 B
Java
26 lines
739 B
Java
package cn.van333.wxsend.exception;
|
||
|
||
import cn.van333.wxsend.business.model.R;
|
||
import org.springframework.http.HttpStatus;
|
||
import org.springframework.http.ResponseEntity;
|
||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
||
/**
|
||
* @author Leo
|
||
* @version 1.0
|
||
* @create 2023/10/10 0010 下午 05:28
|
||
* @description:
|
||
*/
|
||
@ControllerAdvice
|
||
public class RateLimitExceptionHandler {
|
||
|
||
@ExceptionHandler(ServiceException.class)
|
||
@ResponseBody
|
||
public R handleRateLimitException(ServiceException ex) {
|
||
String errorMessage = ex.getMessage();
|
||
return R.error(errorMessage);
|
||
}
|
||
}
|