From a9afd44a91c0693d4c9a14a6a16bebdb2046b6ac Mon Sep 17 00:00:00 2001 From: Peter Hamilton Date: Thu, 17 May 2018 13:28:11 -0400 Subject: [PATCH] Add a better error message when reading unparseable attributes This change adds a basic error message that gets raised when attempting to read an unparseable attribute (i.e., an attribute that is not supported by the library). Fixes #429 --- kmip/core/objects.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kmip/core/objects.py b/kmip/core/objects.py index 195ccb3..5b518ec 100644 --- a/kmip/core/objects.py +++ b/kmip/core/objects.py @@ -112,6 +112,8 @@ class Attribute(Struct): enum_type = name 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.tag = Tags.ATTRIBUTE_VALUE self.attribute_value.read(tstream)