From 61fd67ed738691c55e79840acf5c333464501d23 Mon Sep 17 00:00:00 2001 From: sebastianMindee Date: Wed, 26 Mar 2025 16:45:38 +0100 Subject: [PATCH 1/2] :recycle: fix invalid catch mechanism for polling --- docs/extras/guide/expense_receipts_v5.md | 3 ++- docs/extras/guide/financial_document_v1.md | 3 ++- docs/extras/guide/invoices_v4.md | 3 ++- mindee/client.py | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/extras/guide/expense_receipts_v5.md b/docs/extras/guide/expense_receipts_v5.md index b8b58d0c..fedf7175 100644 --- a/docs/extras/guide/expense_receipts_v5.md +++ b/docs/extras/guide/expense_receipts_v5.md @@ -189,7 +189,8 @@ Aside from the basic `BaseField` attributes, the tax field `TaxField` also imple * **rate** (`float`): the tax rate applied to an item expressed as a percentage. Can be `None`. * **code** (`str`): tax code (or equivalent, depending on the origin of the document). Can be `None`. -* **base** (`float`): base amount used for the tax. Can be `None`. +* **basis** (`float`): base amount used for the tax. Can be `None`. +* **value** (`float`): the value of the tax. Can be `None`. > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, a list-like structure. diff --git a/docs/extras/guide/financial_document_v1.md b/docs/extras/guide/financial_document_v1.md index 79f20a33..fe699702 100644 --- a/docs/extras/guide/financial_document_v1.md +++ b/docs/extras/guide/financial_document_v1.md @@ -233,7 +233,8 @@ Aside from the basic `BaseField` attributes, the tax field `TaxField` also imple * **rate** (`float`): the tax rate applied to an item expressed as a percentage. Can be `None`. * **code** (`str`): tax code (or equivalent, depending on the origin of the document). Can be `None`. -* **base** (`float`): base amount used for the tax. Can be `None`. +* **basis** (`float`): base amount used for the tax. Can be `None`. +* **value** (`float`): the value of the tax. Can be `None`. > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, a list-like structure. diff --git a/docs/extras/guide/invoices_v4.md b/docs/extras/guide/invoices_v4.md index 63c7e484..eb87e34e 100644 --- a/docs/extras/guide/invoices_v4.md +++ b/docs/extras/guide/invoices_v4.md @@ -221,7 +221,8 @@ Aside from the basic `BaseField` attributes, the tax field `TaxField` also imple * **rate** (`float`): the tax rate applied to an item expressed as a percentage. Can be `None`. * **code** (`str`): tax code (or equivalent, depending on the origin of the document). Can be `None`. -* **base** (`float`): base amount used for the tax. Can be `None`. +* **basis** (`float`): base amount used for the tax. Can be `None`. +* **value** (`float`): the value of the tax. Can be `None`. > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, a list-like structure. diff --git a/mindee/client.py b/mindee/client.py index 901b68cb..00d23a7d 100644 --- a/mindee/client.py +++ b/mindee/client.py @@ -351,6 +351,8 @@ def enqueue_and_parse( while retry_counter < max_retries: if poll_results.job.status == "completed": break + if poll_results.job.status == "failed": + raise MindeeError("Parsing failed.") logger.debug( "Polling server for parsing result with job id: %s", queue_result.job.id ) From 1c0270781df597f56d6d60968356f8d58702a161 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:57:22 +0100 Subject: [PATCH 2/2] add job id to error if job status failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ianaré <97107275+ianardee@users.noreply.github.com> --- mindee/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindee/client.py b/mindee/client.py index 00d23a7d..85efa354 100644 --- a/mindee/client.py +++ b/mindee/client.py @@ -352,7 +352,7 @@ def enqueue_and_parse( if poll_results.job.status == "completed": break if poll_results.job.status == "failed": - raise MindeeError("Parsing failed.") + raise MindeeError("Parsing failed for job {poll_results.job.id}") logger.debug( "Polling server for parsing result with job id: %s", queue_result.job.id )