From 29af788f835dc32f8e88142a83162f0107e34b9c Mon Sep 17 00:00:00 2001 From: Wassilios Lytras Date: Sat, 4 May 2024 23:52:48 +0200 Subject: [PATCH] Raise missing partner/org errors also for partnership --- pyas2lib/as2.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pyas2lib/as2.py b/pyas2lib/as2.py index e65c288..2e03331 100644 --- a/pyas2lib/as2.py +++ b/pyas2lib/as2.py @@ -635,12 +635,13 @@ def parse( self.receiver, self.sender = find_org_partner_cb(org_id, partner_id) elif find_org_cb and find_partner_cb: self.receiver = find_org_cb(org_id) - if not self.receiver: - raise PartnerNotFound(f"Unknown AS2 organization with id {org_id}") - self.sender = find_partner_cb(partner_id) - if not self.sender: - raise PartnerNotFound(f"Unknown AS2 partner with id {partner_id}") + + if not self.receiver: + raise PartnerNotFound(f"Unknown AS2 organization with id {org_id}") + + if not self.sender: + raise PartnerNotFound(f"Unknown AS2 partner with id {partner_id}") if find_message_cb and find_message_cb(self.message_id, partner_id): raise DuplicateDocument(