Skip to content

Commit

Permalink
Make sure that exception is being caught.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Feb 27, 2024
1 parent da4e0e9 commit 3dedabf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/controller/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from lxml import etree
from werkzeug import Response as wkResponse

from api.circulation_exceptions import CirculationException
from api.circulation_exceptions import CirculationException, RemoteInitiatedServerError
from api.controller.circulation_manager import CirculationManagerController
from api.problem_details import (
BAD_DELIVERY_MECHANISM,
Expand Down Expand Up @@ -146,7 +146,7 @@ def _borrow(self, patron, credential, pool, mechanism):
patron, credential, pool, mechanism
)
result = loan or hold
except CirculationException as e:
except (CirculationException, RemoteInitiatedServerError) as e:
result = e.problem_detail

if result is None:
Expand Down Expand Up @@ -322,7 +322,7 @@ def fulfill(
requested_license_pool,
mechanism,
)
except CirculationException as e:
except (CirculationException, RemoteInitiatedServerError) as e:
return e.problem_detail

# A subclass of FulfillmentInfo may want to bypass the whole
Expand Down Expand Up @@ -446,15 +446,15 @@ def revoke(self, license_pool_id):
if loan:
try:
self.circulation.revoke_loan(patron, credential, pool)
except CirculationException as e:
except (CirculationException, RemoteInitiatedServerError) as e:
return e.problem_detail
elif hold:
if not self.circulation.can_revoke_hold(pool, hold):
title = _("Cannot release a hold once it enters reserved state.")
return CANNOT_RELEASE_HOLD.detailed(title, 400)
try:
self.circulation.release_hold(patron, credential, pool)
except CirculationException as e:
except (CirculationException, RemoteInitiatedServerError) as e:
return e.problem_detail

work = pool.work
Expand Down

0 comments on commit 3dedabf

Please sign in to comment.