From 24d6e36d9fb00e5079171828b74777dd1feb4c05 Mon Sep 17 00:00:00 2001
From: nicofrand <mail@nicofrand.eu>
Date: Thu, 11 Jul 2024 09:03:27 +0200
Subject: [PATCH] [bnp] Wrap comptes titres retrieval in try/catch and log an
 error on failure instead of throwing

---
 modules/bnp/pp/browser.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/bnp/pp/browser.py b/modules/bnp/pp/browser.py
index 1c4f7e8b99..e54dd3062e 100644
--- a/modules/bnp/pp/browser.py
+++ b/modules/bnp/pp/browser.py
@@ -358,8 +358,15 @@ def iter_accounts(self):
                 ibans=ibans,
                 is_pro=is_pro,
             ))
-            self.market_syn.go(json={})
-            market_accounts = self.page.get_list()  # get the list of 'Comptes Titres'
+
+            # 'Comptes Titres' retrieval is broken
+            try:
+                self.market_syn.go(json={})
+                market_accounts = self.page.get_list()  # get the list of 'Comptes Titres'
+            except HTTPNotFound:
+                self.logger.warn('Could not retrieve "Comptes Titres" accounts')
+                market_accounts = []
+
             checked_accounts = set()
             for account in accounts:
                 if self.is_loan(account):
-- 
GitLab