Merge pull request #436 from OpenKMIP/feat/improve-attribute-error-msg

Add a better error message when reading unparseable attributes
This commit is contained in:
Peter Hamilton 2018-05-17 14:13:34 -04:00 committed by GitHub
commit b0bd77e0d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -112,6 +112,8 @@ class Attribute(Struct):
enum_type = name enum_type = name
value = self.value_factory.create_attribute_value(enum_type, None) value = self.value_factory.create_attribute_value(enum_type, None)
if value is None:
raise Exception("No value type for {}".format(enum_name))
self.attribute_value = value self.attribute_value = value
self.attribute_value.tag = Tags.ATTRIBUTE_VALUE self.attribute_value.tag = Tags.ATTRIBUTE_VALUE
self.attribute_value.read(tstream) self.attribute_value.read(tstream)