From a5d0c13ebd40aeccf8c71ca4efb350439ed5e1a5 Mon Sep 17 00:00:00 2001 From: Thibault Douge Date: Mon, 12 Apr 2021 16:46:04 +0200 Subject: [PATCH] [orange] return empty list of invoices if the user is not the account holder --- modules/orange/browser.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/orange/browser.py b/modules/orange/browser.py index e779d042f2..62ec968c25 100644 --- a/modules/orange/browser.py +++ b/modules/orange/browser.py @@ -299,6 +299,14 @@ def iter_documents(self, subscription): return [] raise + except ClientError as e: + if e.response.status_code == 412: + # if the code is 412 the user is not the owner of the subscription and we can't get the invoices + msg = e.response.json()['error']['customerMessage']['subMessage'] + self.logger.info("no documents because: %s", msg) + return [] + raise + for b in self.page.get_bills(subid=subscription.id): documents.append(b) return iter(documents) @@ -327,5 +335,5 @@ def download_document(self, document): except ClientError as e: if e.response.status_code == 422: # if the code is 422 the download of the document is currently unavailable - return NotAvailable + raise -- GitLab