diff --git a/armada/api/server.py b/armada/api/server.py index 1b8479b7..4b8f3f61 100644 --- a/armada/api/server.py +++ b/armada/api/server.py @@ -31,6 +31,7 @@ from armada.api.controller.tiller import Release from armada.api.controller.tiller import Status from armada.api.controller.validation import Validate from armada.api.controller.versions import Versions +from armada.exceptions import base_exception as exceptions conf.set_app_default_configs() CONF = cfg.CONF @@ -76,6 +77,15 @@ def create(enable_middleware=CONF.middleware): # Initialize policy config options. policy.Enforcer(CONF) + # Error handlers (FILO handling) + api.add_error_handler(exceptions.ArmadaBaseException, + exceptions.default_exception_handler) + api.add_error_handler(exceptions.ArmadaAPIException, + exceptions.ArmadaAPIException.handle) + + # Built-in error serializer + api.set_error_serializer(exceptions.default_error_serializer) + return api