diff --git a/samtranslator/plugins/sam_plugins.py b/samtranslator/plugins/sam_plugins.py index c98e2cbb7..98a55263b 100644 --- a/samtranslator/plugins/sam_plugins.py +++ b/samtranslator/plugins/sam_plugins.py @@ -1,5 +1,5 @@ import logging -from samtranslator.model.exceptions import InvalidResourceException, InvalidDocumentException +from samtranslator.model.exceptions import InvalidResourceException, InvalidDocumentException, InvalidTemplateException from samtranslator.plugins import BasePlugin, LifeCycleEvents LOG = logging.getLogger(__name__) @@ -130,7 +130,7 @@ def act(self, event, *args, **kwargs): try: getattr(plugin, method_name)(*args, **kwargs) - except (InvalidResourceException, InvalidDocumentException) as ex: + except (InvalidResourceException, InvalidDocumentException, InvalidTemplateException) as ex: # Don't need to log these because they don't result in crashes raise ex except Exception as ex: diff --git a/samtranslator/translator/translator.py b/samtranslator/translator/translator.py index 2824dd8d6..b40737c36 100644 --- a/samtranslator/translator/translator.py +++ b/samtranslator/translator/translator.py @@ -16,6 +16,7 @@ InvalidResourceException, DuplicateLogicalIdException, InvalidEventException, + InvalidTemplateException, ) from samtranslator.intrinsics.resolver import IntrinsicsResolver from samtranslator.intrinsics.actions import FindInMapAction @@ -163,7 +164,7 @@ def translate(self, sam_template, parameter_values, feature_toggle=None, passthr document_errors.append( DuplicateLogicalIdException(logical_id, resource.logical_id, resource.resource_type) ) - except (InvalidResourceException, InvalidEventException) as e: + except (InvalidResourceException, InvalidEventException, InvalidTemplateException) as e: document_errors.append(e) if deployment_preference_collection.any_enabled(): @@ -183,7 +184,7 @@ def translate(self, sam_template, parameter_values, feature_toggle=None, passthr # Run the after-transform plugin target try: sam_plugins.act(LifeCycleEvents.after_transform_template, template) - except (InvalidDocumentException, InvalidResourceException) as e: + except (InvalidDocumentException, InvalidResourceException, InvalidTemplateException) as e: document_errors.append(e) # Cleanup