@@ -1448,19 +1448,15 @@ def process_document_section(self, document: Document, section_id: str) -> Docum
14481448 )
14491449 logger .info (f"error_message: { error_message } " )
14501450 if error_message :
1451- logger .error (f"Error: { error_message } " )
1451+ logger .error (f"** Error: { error_message } " )
14521452 document .status = Status .FAILED
14531453 document .errors .append (error_message )
14541454
14551455 # Add task errors to document errors
1456- task_errors = [
1457- t .error_message
1458- for t in failed_tasks
1459- if t .error_message and not self .is_parsing_error (t .error_message )
1460- ]
1456+ task_errors = [t .error_message for t in failed_tasks if t .error_message ]
14611457 if task_errors :
14621458 error_msg = self ._convert_error_list_to_string (task_errors )
1463- logger .error (f"Task Error: { error_message } " )
1459+ logger .error (f"*** Task Error: { error_message } " )
14641460 document .status = Status .FAILED
14651461 document .errors .append (error_msg )
14661462
@@ -1530,62 +1526,6 @@ def assess_document(self, document: Document) -> Document:
15301526 logger .info (f"Completed granular assessment for document { document .id } " )
15311527 return document
15321528
1533- def _handle_parsing_errors (
1534- self ,
1535- document : Document ,
1536- failed_tasks : List [str ],
1537- document_text : str ,
1538- extraction_results : Dict ,
1539- ) -> Optional [str ]:
1540- """Handle multiple parsing errors with user-friendly messaging."""
1541- # Check for token limit issues
1542- token_warning = check_token_limit (
1543- document_text , extraction_results , self .config
1544- )
1545- logger .info (f"Token Warning: { token_warning } " )
1546- error_count = len (failed_tasks )
1547- base_msg = f"Assessment failed for { error_count } tasks. "
1548- if token_warning :
1549- return base_msg + token_warning
1550- else :
1551- return None
1552-
1553- def is_parsing_error (self , error_message : str ) -> bool :
1554- """Check if an error message is related to parsing issues."""
1555- parsing_errors = ["parsing" ]
1556- return any (error .lower () in error_message .lower () for error in parsing_errors )
1557-
1558- def _convert_error_list_to_string (self , errors ) -> str :
1559- """Convert list of error messages to a single user-friendly string."""
1560- if not errors :
1561- return ""
1562-
1563- # Handle single string input
1564- if isinstance (errors , str ):
1565- return errors
1566-
1567- # Ensure we have a list of strings
1568- if not isinstance (errors , list ):
1569- return str (errors )
1570-
1571- # Count different types of errors
1572- parsing_errors = [e for e in errors if "parsing" in e .lower ()]
1573- other_errors = [e for e in errors if "parsing" not in e .lower ()]
1574-
1575- if len (parsing_errors ) > 10 :
1576- # Too many parsing errors - summarize
1577- return (
1578- f"Multiple parsing errors occurred { len (parsing_errors )} parsing errors, "
1579- f"{ len (other_errors )} other errors. This suggests document complexity or token limit issues."
1580- )
1581- elif len (errors ) > 5 :
1582- # Multiple errors - show first few and summarize
1583- first_errors = "; " .join (errors [:1 ])
1584- return f"{ first_errors } and { len (errors ) - 1 } more errors"
1585- else :
1586- # Few errors - show all
1587- return "; " .join (errors )
1588-
15891529 def _handle_parsing_errors (
15901530 self ,
15911531 document : Document ,
0 commit comments