Fix error message for missing log stream (#4043)

This commit is contained in:
Brian Pandola 2021-06-28 22:06:14 -07:00 committed by GitHub
parent a230e2a7e3
commit 315c357cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -333,7 +333,7 @@ class LogGroup(BaseModel):
self, log_group_name, log_stream_name, log_events, sequence_token
):
if log_stream_name not in self.streams:
raise ResourceNotFoundException()
raise ResourceNotFoundException("The specified log stream does not exist.")
stream = self.streams[log_stream_name]
return stream.put_log_events(
log_group_name, log_stream_name, log_events, sequence_token

View File

@ -46,12 +46,15 @@ def test_exceptions():
logEvents=[{"timestamp": 0, "message": "line"}],
)
with pytest.raises(ClientError):
with pytest.raises(ClientError) as ex:
conn.put_log_events(
logGroupName=log_group_name,
logStreamName="invalid-stream",
logEvents=[{"timestamp": 0, "message": "line"}],
)
error = ex.value.response["Error"]
error["Code"].should.equal("ResourceNotFoundException")
error["Message"].should.equal("The specified log stream does not exist.")
@mock_logs