Skip to content

Commit

Permalink
serializers: catch anonymized patrons for transaction pid
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed Jun 17, 2024
1 parent f9bb9b9 commit 8cd22ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion invenio_app_ils/circulation/serializers/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from invenio_pidstore.errors import PIDDeletedError, PIDDoesNotExistError

from invenio_app_ils.circulation.utils import circulation_overdue_loan_days
from invenio_app_ils.errors import PatronNotFoundError
from invenio_app_ils.proxies import current_app_ils
from invenio_app_ils.records.jsonresolvers.api import pick

Expand Down Expand Up @@ -67,6 +68,6 @@ def field_transaction_user(metadata):
Patron = current_app_ils.patron_cls
try:
transaction_user = Patron.get_patron(transaction_user_pid)
except PIDDeletedError:
except (PIDDeletedError, PatronNotFoundError):
return
metadata["transaction_user"] = pick(transaction_user, "name")

0 comments on commit 8cd22ed

Please sign in to comment.