projects
/
hooke.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f6efdc5
)
Log errors when instantiation fails in hooke.util.pluggable.construct_*().
author
W. Trevor King
<wking@drexel.edu>
Wed, 29 Sep 2010 14:08:00 +0000
(10:08 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Wed, 29 Sep 2010 14:08:00 +0000
(10:08 -0400)
hooke/util/pluggable.py
patch
|
blob
|
history
diff --git
a/hooke/util/pluggable.py
b/hooke/util/pluggable.py
index 1379c82c4ed5f6d05d950743d127a08656d3bd99..a0a669d469c78fd6f5ca31352c37048bf75937b1 100644
(file)
--- a/
hooke/util/pluggable.py
+++ b/
hooke/util/pluggable.py
@@
-97,7
+97,12
@@
def construct_odict(this_modname, submodnames, class_selector,
obj = getattr(submod, objname)
if class_selector(obj):
if instantiate == True:
obj = getattr(submod, objname)
if class_selector(obj):
if instantiate == True:
- obj = obj()
+ try:
+ obj = obj()
+ except Exception, e:
+ logging.error('could not instantiate %s from %s: %s'
+ % (obj, submodname, e))
+ raise
name = getattr(obj, 'name', submodname)
objs[name] = obj
return objs
name = getattr(obj, 'name', submodname)
objs[name] = obj
return objs
@@
-121,7
+126,12
@@
def construct_graph(this_modname, submodnames, class_selector,
for objname in dir(submod):
obj = getattr(submod, objname)
if class_selector(obj):
for objname in dir(submod):
obj = getattr(submod, objname)
if class_selector(obj):
- instance = obj()
+ try:
+ instance = obj()
+ except Exception, e:
+ logging.error('could not instantiate %s from %s: %s'
+ % (obj, submodname, e))
+ raise
if assert_name_match == True and instance.name != submodname:
raise Exception(
'Instance name %s does not match module name %s'
if assert_name_match == True and instance.name != submodname:
raise Exception(
'Instance name %s does not match module name %s'