Avoid throwing exceptions when unneeded to avoid problems
parent
4c6519cf43
commit
855bc96863
|
@ -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'])
|
||||||
|
|
Loading…
Reference in New Issue