Skip to content

Commit 61b93fd

Browse files
committed
fix: try catch
1 parent 1f7c46f commit 61b93fd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pyeudiw/trust/anchors_loader.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pyeudiw.jwt.utils import decode_jwt_payload
33
from pyeudiw.storage.db_engine import DBEngine, TrustType
44
from pyeudiw.x509.verify import get_expiry_date_from_x5c
5+
from pyeudiw.storage.exceptions import EntryNotFound
56

67
class AnchorsLoader:
78
@staticmethod
@@ -19,9 +20,11 @@ def load_anchors(db: DBEngine, config: list[dict]) -> None:
1920
entity_id = anchor.get("entity_id")
2021
if entity_id is None:
2122
raise ValueError("An entity_id is required for each trust anchor.")
22-
23-
if db.has_trust_anchor(entity_id):
24-
db.add_empty_trust_anchor(anchor)
23+
24+
try:
25+
db.has_trust_anchor(entity_id)
26+
except EntryNotFound:
27+
db.add_empty_trust_anchor(entity_id)
2528

2629
if "x509" in anchor:
2730
db.update_trust_anchor(

0 commit comments

Comments
 (0)