| 123456789101112131415161718192021222324 |
- package com.toolpage.toolpageservice.ToolPageController;
- import com.toolpage.toolpageservice.tool.RW;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.web.bind.annotation.ExceptionHandler;
- import org.springframework.web.bind.annotation.RestControllerAdvice;
- import reactor.core.publisher.Mono;
- @Slf4j
- @RestControllerAdvice
- public class CustomExceptionHandler {
- @ExceptionHandler(Exception.class)
- public Mono<RW<Object>> handleCustomException(Exception e) {
- log.info("捕获到未处理的Exception异常:{}",e);
- return RW.fail("9999",Mono.just(e.getMessage()));
- }
- // @ExceptionHandler(BusinessException.class)
- // public Mono<RW<Object>> handleBusinessException(BusinessException e) {
- // log.info("捕获到BusinessException异常:{}",e);
- // return RW.fail(e.getCode(),e.getMessage());
- // }
- }
|