Skip to content

Commit 2734224

Browse files
committed
chg: Raise exception on missing template in CSVLoader
Related: #714
1 parent b5b2f70 commit 2734224

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pymisp/tools/csvloader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def load(self):
3838
else:
3939
# Check if the CSV file has a header, and if it matches with the object template
4040
tmp_object = MISPObject(self.template_name)
41+
if not tmp_object._definition['attributes']:
42+
raise Exception(f'Unable to find the object template ({self.template_name}), impossible to create objects.')
4143
allowed_fieldnames = list(tmp_object._definition['attributes'].keys())
4244
for fieldname in self.fieldnames:
4345
if fieldname not in allowed_fieldnames:

0 commit comments

Comments
 (0)