mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-23 15:43:54 +08:00
udate:优化异常显示 (#701)
This commit is contained in:
@@ -4,6 +4,7 @@ import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -53,4 +54,10 @@ public class RenExceptionHandler {
|
||||
return new Result<Void>().error();
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoResourceFoundException.class)
|
||||
public Result<Void> handleNoResourceFoundException(NoResourceFoundException ex) {
|
||||
log.warn("Resource not found: {}", ex.getMessage());
|
||||
return new Result<Void>().error(404, "资源不存在");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user