2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-21 18:53:15 +00:00

Remove unused error code

This change removes unused exceptions defined in core/errors.py,
along with the errors.py module itself. The few used items from
this file are migrated over to core/exceptions.py. Any dependent
code is updated, dropping the use of errors.py and adding in the
use of exceptions.py.
This commit is contained in:
Peter Hamilton
2017-12-07 20:11:18 -05:00
parent d984c77211
commit 54b1df7726
14 changed files with 247 additions and 220 deletions

View File

@@ -16,13 +16,12 @@
import six
from kmip.core import enums
from kmip.core import exceptions
from kmip.core.enums import HashingAlgorithm as HashingAlgorithmEnum
from kmip.core.enums import KeyFormatType as KeyFormatTypeEnum
from kmip.core.enums import Tags
from kmip.core.errors import ErrorStrings
from kmip.core.misc import KeyFormatType
from kmip.core.primitives import Boolean
@@ -138,7 +137,7 @@ class Name(Struct):
def __validate(self):
name = Name.__name__
msg = ErrorStrings.BAD_EXP_RECV
msg = exceptions.ErrorStrings.BAD_EXP_RECV
if self.name_value and \
not isinstance(self.name_value, Name.NameValue) and \
not isinstance(self.name_value, str):
@@ -165,7 +164,7 @@ class Name(Struct):
value = cls.NameValue(name_value)
else:
name = 'Name'
msg = ErrorStrings.BAD_EXP_RECV
msg = exceptions.ErrorStrings.BAD_EXP_RECV
member = 'name_value'
raise TypeError(msg.format('{0}.{1}'.format(name, member),
'name_value', type(Name.NameValue),
@@ -177,7 +176,7 @@ class Name(Struct):
n_type = cls.NameType(name_type)
else:
name = 'Name'
msg = ErrorStrings.BAD_EXP_RECV
msg = exceptions.ErrorStrings.BAD_EXP_RECV
member = 'name_type'
raise TypeError(msg.format('{0}.{1}'.format(name, member),
'name_type', type(Name.NameType),