From b82aa439fa386d2c9679966880c3cd518e7467fa Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Oct 2014 14:35:59 +0200 Subject: [PATCH] raise an exception when get/setting a value that doesn't exist --- packer/blendfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packer/blendfile.py b/packer/blendfile.py index c5ea612..756c4af 100644 --- a/packer/blendfile.py +++ b/packer/blendfile.py @@ -92,7 +92,7 @@ class BlendFile: "header", # struct.Struct "block_header_struct", - # FileBlockHeader + # BlendFileBlock "blocks", # DNACatalog "catalog", @@ -509,7 +509,7 @@ class DNAStruct: else: offset += field[2] - return None + raise KeyError("%r not found in %r" % (path, [s[1].name_short for s in self.fields])) def field_set(self, header, handle, path, value): assert(type(path) == bytes) @@ -533,7 +533,7 @@ class DNAStruct: else: offset += field[2] - return None + raise KeyError("%r not found in %r" % (path, [s[1].name_short for s in self.fields])) class DNA_IO: