diff --git a/aries_cloudagent/admin/server.py b/aries_cloudagent/admin/server.py index e6117ba333..5cc6ab740a 100644 --- a/aries_cloudagent/admin/server.py +++ b/aries_cloudagent/admin/server.py @@ -12,6 +12,7 @@ from marshmallow import fields, Schema from ..classloader import ClassLoader +from ..config.base import ConfigError from ..config.injection_context import InjectionContext from ..messaging.outbound_message import OutboundMessage from ..messaging.responder import BaseResponder @@ -170,12 +171,9 @@ async def collect_stats(request, handler): ) await routes_module.register(self.app) except Exception as e: - self.logger.error( + raise ConfigError( f"Failed to load external protocol module '{protocol_module_path}'." - + "\n" - + str(e) - ) - raise + ) from e cors = aiohttp_cors.setup( app, @@ -288,7 +286,7 @@ async def status_reset_handler(self, request: web.BaseRequest): collector: Collector = await self.context.inject(Collector, required=False) if collector: collector.reset() - raise web.HTTPOk() + return web.json_response({}) async def redirect_handler(self, request: web.BaseRequest): """Perform redirect to documentation.""" diff --git a/aries_cloudagent/config/default_context.py b/aries_cloudagent/config/default_context.py index 8f5dd55e47..19ff5d008b 100644 --- a/aries_cloudagent/config/default_context.py +++ b/aries_cloudagent/config/default_context.py @@ -131,8 +131,8 @@ async def bind_providers(self, context: InjectionContext): except Exception as e: raise ConfigError( "Failed to load external protocol module " - + f"'{protocol_module_path}': {str(e)}." - ) + + f"'{protocol_module_path}'" + ) from e context.injector.bind_instance(ProtocolRegistry, protocol_registry) # Register message serializer