This commit is contained in:
wells
2026-08-05 13:48:48 +08:00
commit 1303bf37dc
80 changed files with 5154 additions and 0 deletions
@@ -0,0 +1,26 @@
package com.tailbet.config;
import com.tailbet.model.vo.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* 全局异常处理
*/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(RuntimeException.class)
public R<?> handleRuntimeException(RuntimeException e) {
log.error("业务异常: {}", e.getMessage());
return R.fail(e.getMessage());
}
@ExceptionHandler(Exception.class)
public R<?> handleException(Exception e) {
log.error("系统异常: {}", e.getMessage(), e);
return R.fail("系统错误: " + e.getMessage());
}
}