refactor: Improve error handling and remove unused code
parent
17f9a97ce4
commit
bd0fb766f8
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue