Skip to content

Commit

Permalink
Check for ledger errors on admin api's
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Costanzo <ian@anon-solutions.ca>
  • Loading branch information
ianco committed Jul 31, 2020
1 parent 54ce8be commit 741f6db
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aries_cloudagent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from ..config.injection_context import InjectionContext
from ..core.plugin_registry import PluginRegistry
from ..ledger.error import LedgerConfigError
from ..messaging.responder import BaseResponder
from ..transport.queue.basic import BasicMessageQueue
from ..transport.outbound.message import OutboundMessage
Expand Down Expand Up @@ -131,7 +132,12 @@ async def ready_middleware(request: web.BaseRequest, handler: Coroutine):
"/status/live",
"/status/ready",
) or request.app._state.get("ready"):
return await handler(request)
try:
return await handler(request)
except LedgerConfigError:
# fatal, signal server shutdown
request.app.notify_fatal_error()
raise

raise web.HTTPServiceUnavailable(reason="Shutdown in progress")

Expand Down

0 comments on commit 741f6db

Please sign in to comment.