refactor: Improve error handling and remove unused code

This commit is contained in:
begoniezhao
2026-01-14 14:15:08 +08:00
parent 17f9a97ce4
commit bd0fb766f8
2 changed files with 9 additions and 3 deletions
+9 -1
View File
@@ -57,7 +57,15 @@ class FirstParser(BaseParser):
"""
for p in self._parsers:
logger.info(f"FirstParser: using parser {p.__class__.__name__}")
document = p.parse_into_text(content)
try:
document = p.parse_into_text(content)
except Exception:
logger.exception(
"FirstParser: parser %s raised exception; trying next parser",
p.__class__.__name__,
)
continue
if document.is_valid():
logger.info(f"FirstParser: parser {p.__class__.__name__} succeeded")
return document
-2
View File
@@ -1,7 +1,6 @@
package handler
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -470,7 +469,6 @@ func (h *KnowledgeBaseHandler) GetKBCloneProgress(c *gin.Context) {
// validateExtractConfig validates the graph configuration parameters
func validateExtractConfig(config *types.ExtractConfig) error {
logger.Errorf(context.Background(), "Validating extract configuration: %+v", config)
if config == nil {
return nil
}