Return a sensible error when the parameter is not found
This commit is contained in:
parent
3816eba58f
commit
715ff0f7af
@ -145,6 +145,13 @@ class SimpleSystemManagerResponse(BaseResponse):
|
||||
|
||||
result = self.ssm_backend.get_parameter_history(name, with_decryption)
|
||||
|
||||
if result is None:
|
||||
error = {
|
||||
"__type": "ParameterNotFound",
|
||||
"message": "Parameter {0} not found.".format(name),
|
||||
}
|
||||
return json.dumps(error), dict(status=400)
|
||||
|
||||
response = {"Parameters": []}
|
||||
for parameter_version in result:
|
||||
param_data = parameter_version.describe_response_object(
|
||||
|
@ -879,6 +879,20 @@ def test_get_parameter_history_with_secure_string():
|
||||
len(parameters_response).should.equal(3)
|
||||
|
||||
|
||||
@mock_ssm
|
||||
def test_get_parameter_history_missing_parameter():
|
||||
client = boto3.client("ssm", region_name="us-east-1")
|
||||
|
||||
try:
|
||||
client.get_parameter_history(Name="test_noexist")
|
||||
raise RuntimeError("Should have failed")
|
||||
except botocore.exceptions.ClientError as err:
|
||||
err.operation_name.should.equal("GetParameterHistory")
|
||||
err.response["Error"]["Message"].should.equal(
|
||||
"Parameter test_noexist not found."
|
||||
)
|
||||
|
||||
|
||||
@mock_ssm
|
||||
def test_add_remove_list_tags_for_resource():
|
||||
client = boto3.client("ssm", region_name="us-east-1")
|
||||
|
Loading…
Reference in New Issue
Block a user