From 808162d4c4f29588a58e397953e2e29f25aa9c61 Mon Sep 17 00:00:00 2001 From: Fridolin Pokorny <fridolin@redhat.com> Date: Wed, 4 Apr 2018 15:50:02 +0200 Subject: [PATCH] Fix KeyError when using help() When calling Python's help() on a mapped item, there is raised KeyError with __objclass__ being the requested key. --- goblin/exception.py | 2 +- goblin/mapper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/goblin/exception.py b/goblin/exception.py index 51f0ea5..aa4698a 100644 --- a/goblin/exception.py +++ b/goblin/exception.py @@ -6,7 +6,7 @@ class ClientError(Exception): pass -class MappingError(Exception): +class MappingError(AttributeError): pass diff --git a/goblin/mapper.py b/goblin/mapper.py index c7cacbb..efb4616 100644 --- a/goblin/mapper.py +++ b/goblin/mapper.py @@ -215,7 +215,7 @@ class Mapping: try: mapping, _ = self._ogm_properties[value] return mapping - except: + except KeyError: raise exception.MappingError( "unrecognized property {} for class: {}".format( value, self._element_type)) -- GitLab