refactor: Improve error handling and remove unused code
This commit is contained in:
@@ -57,7 +57,15 @@ class FirstParser(BaseParser):
|
|||||||
"""
|
"""
|
||||||
for p in self._parsers:
|
for p in self._parsers:
|
||||||
logger.info(f"FirstParser: using parser {p.__class__.__name__}")
|
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():
|
if document.is_valid():
|
||||||
logger.info(f"FirstParser: parser {p.__class__.__name__} succeeded")
|
logger.info(f"FirstParser: parser {p.__class__.__name__} succeeded")
|
||||||
return document
|
return document
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -470,7 +469,6 @@ func (h *KnowledgeBaseHandler) GetKBCloneProgress(c *gin.Context) {
|
|||||||
|
|
||||||
// validateExtractConfig validates the graph configuration parameters
|
// validateExtractConfig validates the graph configuration parameters
|
||||||
func validateExtractConfig(config *types.ExtractConfig) error {
|
func validateExtractConfig(config *types.ExtractConfig) error {
|
||||||
logger.Errorf(context.Background(), "Validating extract configuration: %+v", config)
|
|
||||||
if config == nil {
|
if config == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user