From 2ea5e21803f48ed1f1bd71058e5dd0676885ffd7 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 28 Jun 2022 17:05:18 +0200 Subject: [PATCH 4/4] wip --- eopayment/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/eopayment/__init__.py b/eopayment/__init__.py index dccc407..b9a2e2a 100644 --- a/eopayment/__init__.py +++ b/eopayment/__init__.py @@ -299,14 +299,22 @@ class Payment: backends is to limit the type of backends if the possible backends are known. ''' + last_exception = None + for kind, backend in get_backends().items(): if not hasattr(backend, 'guess'): continue if backends and kind not in backends: continue - transaction_id = backend.guess( - method=method, query_string=query_string, body=body, headers=headers - ) + try: + transaction_id = backend.guess( + method=method, query_string=query_string, body=body, headers=headers + ) + except Exception as e: + last_exception = e + continue if transaction_id: return kind, transaction_id + if last_exception is not None: + raise last_exception raise BackendNotFound -- 2.35.1