Avoid throwing exceptions when unneeded to avoid problems

master
Zach Rush 2019-09-13 14:54:52 -04:00
parent 4c6519cf43
commit 855bc96863
1 changed files with 1 additions and 3 deletions

View File

@ -139,14 +139,12 @@ class MarkingDefinition(_STIXBase, _MarkingsMixin):
except KeyError: except KeyError:
raise ValueError("definition_type must be a valid marking type") raise ValueError("definition_type must be a valid marking type")
try: if 'created' in kwargs:
if _should_set_millisecond(kwargs['created'], marking_type): if _should_set_millisecond(kwargs['created'], marking_type):
self._properties = copy.deepcopy(self._properties) self._properties = copy.deepcopy(self._properties)
self._properties.update([ self._properties.update([
('created', TimestampProperty(default=lambda: NOW, precision='millisecond')), ('created', TimestampProperty(default=lambda: NOW, precision='millisecond')),
]) ])
except KeyError:
pass
if not isinstance(kwargs['definition'], marking_type): if not isinstance(kwargs['definition'], marking_type):
defn = _get_dict(kwargs['definition']) defn = _get_dict(kwargs['definition'])