fix: The wrong class name was used when there is an error at Event creation.

pull/325/head
Raphaël Vinot 2019-01-14 10:11:58 +01:00
parent 1805f2e746
commit ee86f6fa44
1 changed files with 2 additions and 2 deletions

View File

@ -488,14 +488,14 @@ class MISPEvent(AbstractMISP):
# Required value
self.info = kwargs.pop('info', None)
if self.info is None:
raise NewAttributeError('The info field of the new event is required.')
raise NewEventError('The info field of the new event is required.')
# Default values for a valid event to send to a MISP instance
self.distribution = kwargs.pop('distribution', None)
if self.distribution is not None:
self.distribution = int(self.distribution)
if self.distribution not in [0, 1, 2, 3, 4]:
raise NewAttributeError('{} is invalid, the distribution has to be in 0, 1, 2, 3, 4'.format(self.distribution))
raise NewEventError('{} is invalid, the distribution has to be in 0, 1, 2, 3, 4'.format(self.distribution))
if kwargs.get('threat_level_id') is not None:
self.threat_level_id = int(kwargs.pop('threat_level_id'))