week1/bwie-common/src/main/java/com/bwie/common/exception/AllExceptionHandler.java

16 lines
461 B
Java

package com.bwie.common.exception;
import com.bwie.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Log4j2
@RestControllerAdvice
public class AllExceptionHandler {
@ExceptionHandler(AbnormalException.class)
public Result RunExceptionHandler(Throwable e){
return Result.error(e.getMessage());
}
}