mirror of
https://github.com/SELinuxProject/setools
synced 2025-03-11 07:18:15 +00:00
Default: Add better messages for unsupported default values.
For #44 Signed-off-by: Chris PeBenito <pebenito@ieee.org>
This commit is contained in:
parent
ae9b784e6a
commit
46334ed7d4
@ -44,7 +44,10 @@ class DefaultValue(PolicyEnum):
|
||||
sepol.DEFAULT_TARGET_HIGH: sepol.DEFAULT_TARGET,
|
||||
sepol.DEFAULT_TARGET_LOW_HIGH: sepol.DEFAULT_TARGET}
|
||||
|
||||
return cls(default_map[range_])
|
||||
try:
|
||||
return cls(default_map[range_])
|
||||
except KeyError as e:
|
||||
raise LowLevelPolicyError("Unsupported default value: {}".format(e)) from e
|
||||
|
||||
|
||||
class DefaultRangeValue(PolicyEnum):
|
||||
@ -64,7 +67,10 @@ class DefaultRangeValue(PolicyEnum):
|
||||
sepol.DEFAULT_TARGET_HIGH: 2,
|
||||
sepol.DEFAULT_TARGET_LOW_HIGH: 3}
|
||||
|
||||
return cls(default_map[range_])
|
||||
try:
|
||||
return cls(default_map[range_])
|
||||
except KeyError as e:
|
||||
raise LowLevelPolicyError("Unsupported default_range value: {}".format(e)) from e
|
||||
|
||||
|
||||
cdef class Default(PolicyObject):
|
||||
|
Loading…
Reference in New Issue
Block a user