fix: Improve error message in case the object template is unknown.

pull/251/head
Raphaël Vinot 2018-07-05 18:06:58 +02:00
parent 2a772466ae
commit 644337e615
1 changed files with 2 additions and 0 deletions

View File

@ -846,6 +846,8 @@ class MISPObjectAttribute(MISPAttribute):
if self.to_ids is None:
# Same for the to_ids flag
self.to_ids = self._definition.get('to_ids')
if not self.type:
raise NewAttributeError("The type of the attribute is required. Is the object template missing?")
super(MISPObjectAttribute, self).from_dict(**dict(self, **kwargs))
def __repr__(self):