Add new marking errors.

stix2.1
Emmanuelle Vargas-Gonzalez 2017-06-12 08:06:13 -04:00
parent 1f258551e1
commit ee4618f6c8
1 changed files with 26 additions and 0 deletions

View File

@ -150,3 +150,29 @@ class RevokeError(STIXError, ValueError):
return "Cannot revoke an already revoked object."
else:
return "Cannot create a new version of a revoked object."
class InvalidSelectorError(STIXError, ValueError):
"""Granular Marking selector violation. The selector must resolve into an existing STIX object property."""
def __init__(self, cls, key):
super(InvalidSelectorError, self).__init__()
self.cls = cls
self.key = key
def __str__(self):
msg = "Selector '{0}' in '{1}' is not valid!"
return msg.format(self.key, self.__class__.__name__)
class InvalidMarkingError(STIXError, ValueError):
"""Marking violation. The marking reference must be a valid identifier."""
def __init__(self, cls, key):
super(InvalidMarkingError, self).__init__()
self.cls = cls
self.key = key
def __str__(self):
msg = "Marking '{0}' in '{1}' is not a valid marking reference."
return msg.format(self.key, self.__class__.__name__)