Throw error when aspects are empty

This commit is contained in:
Harshal Sheth 2021-02-10 16:27:23 -08:00 committed by Shirshanka Das
parent d801c3e1c4
commit fcd13000ef

View File

@ -11,6 +11,8 @@ class WorkUnitMCEExtractor(Extractor):
pass
def get_records(self, workunit) -> Iterable[RecordEnvelope[MetadataChangeEvent]]:
if len(workunit.mce.proposedSnapshot.aspects) == 0:
raise AttributeError('every mce must have at least one aspect')
yield RecordEnvelope(workunit.mce, {})
def close(self):