From bb9cb74a294dc4526446233e842552abf5e188ea Mon Sep 17 00:00:00 2001 From: Alessio Vertemati Date: Tue, 10 Feb 2026 15:51:46 +0100 Subject: [PATCH] Improve unexpected error checking --- src/parxy_core/drivers/llmwhisperer.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/parxy_core/drivers/llmwhisperer.py b/src/parxy_core/drivers/llmwhisperer.py index 1bf592d..a16c7f6 100644 --- a/src/parxy_core/drivers/llmwhisperer.py +++ b/src/parxy_core/drivers/llmwhisperer.py @@ -183,6 +183,24 @@ def _handle( details=wex.value, ) from wex + # Check if the whisper processing failed server-side. + # The client may return the response without raising an exception, + # but the extraction data will be missing. + status = res.get('status', '') + if ( + status == 'failed' + or 'extraction' not in res + or 'result_text' not in res.get('extraction', {}) + ): + error_msg = res.get( + 'message', 'Document processing failed on LLMWhisperer.' + ) + raise ParsingException( + error_msg, + self.SERVICE_NAME, + details=res, + ) + doc = llmwhisperer_to_parxy(res) doc.filename = filename