diff --git a/samcli/commands/validate/lib/exceptions.py b/samcli/commands/validate/lib/exceptions.py index 96aa3f6008..0348f223da 100644 --- a/samcli/commands/validate/lib/exceptions.py +++ b/samcli/commands/validate/lib/exceptions.py @@ -2,8 +2,10 @@ Custom Exceptions for 'sam validate' commands """ +from samcli.commands.exceptions import UserException -class InvalidSamDocumentException(Exception): + +class InvalidSamDocumentException(UserException): """ Exception for Invalid Sam Documents """ diff --git a/tests/unit/commands/list/resources/test_resources_context.py b/tests/unit/commands/list/resources/test_resources_context.py index 298aef8d53..02e001a370 100644 --- a/tests/unit/commands/list/resources/test_resources_context.py +++ b/tests/unit/commands/list/resources/test_resources_context.py @@ -325,7 +325,7 @@ def test_get_translate_dict_invalid_template_error( } }, } - mock_get_translated_template_if_valid.side_effect = InvalidSamDocumentException() + mock_get_translated_template_if_valid.side_effect = InvalidSamDocumentException("") with self.assertRaises(InvalidSamTemplateException): resource_producer = ResourceMappingProducer( stack_name=None, diff --git a/tests/unit/commands/validate/test_cli.py b/tests/unit/commands/validate/test_cli.py index c19f5d0377..762a24ffa2 100644 --- a/tests/unit/commands/validate/test_cli.py +++ b/tests/unit/commands/validate/test_cli.py @@ -49,7 +49,7 @@ def test_template_fails_validation(self, patched_boto, read_sam_file_patch, clic read_sam_file_patch.return_value = {"a": "b"} get_translated_template_if_valid_mock = Mock() - get_translated_template_if_valid_mock.get_translated_template_if_valid.side_effect = InvalidSamDocumentException + get_translated_template_if_valid_mock.get_translated_template_if_valid.side_effect = InvalidSamDocumentException("") template_valiadator.return_value = get_translated_template_if_valid_mock with self.assertRaises(InvalidSamTemplateException):