Error Handling Strategy
TheErrorHandlingStrategy configuration allows you to specify how the system should respond when errors occur during document processing.
Available Strategies
| Strategy | Description |
|---|---|
ErrorHandlingStrategy.FAIL | Default behavior. Processing stops immediately when any error occurs. The task will fail and return status FAILED. |
ErrorHandlingStrategy.CONTINUE | Processing continues despite non-critical errors. The system will make reasonable attempts to recover and continue with the remaining content. |
How Continue Mode Works
When you seterror_handling=ErrorHandlingStrategy.CONTINUE, the system will attempt to gracefully handle various types of errors:
LLM Processing Errors
If a segment encounters an LLM error:- The system will skip that specific segment instead of failing the entire task
- Processing continues with the remaining segments
Layout Analysis Errors
When usingContinue mode during layout analysis:
- If a page encounters layout detection problems, it defaults to segment type “Page”
- This ensures the content is still accessible even if optimal segmentation fails
- The page’s content will be processed as a single segment
OCR Strategy Fallbacks
InContinue mode with OCR processing:
- If OCR extraction encounters errors, it falls back to using the document’s text layer
- This behaves similarly to
OcrStrategy.AUTOmode - Ensures text content is still available even when OCR processing fails
Example Usage
When to Use Continue Mode
Consider usingErrorHandlingStrategy.CONTINUE when partial results are better than completely failed processing.
For critical applications where accuracy is paramount, you may prefer the default ErrorHandlingStrategy.FAIL to ensure you’re alerted to any processing issues.