Log useful debugging info when you can't read a data value.
authorW. Trevor King <wking@drexel.edu>
Fri, 2 Mar 2012 18:42:01 +0000 (13:42 -0500)
committerW. Trevor King <wking@drexel.edu>
Fri, 2 Mar 2012 18:42:01 +0000 (13:42 -0500)
Now you know the field that caused the problem.  For example:

  Could not access /vibration/0/config/deflection/channel:
    'ellipsis' object has no attribute 'encode'

Is more informative than a traceback that doesn't mention the
troublesome field.

h5config/storage/hdf5.py

index f0a214fb4d558f6a92e475f773de3801bd5579e8..238b9baaf72a8ec0fead7d22be8d4d9632736acb 100644 (file)
@@ -183,7 +183,12 @@ class HDF5_Storage (_FileStorage):
                             config[s.name] = s.config_class()
                         self._load(config=config[s.name], group=cwg)
                 else:
-                    v = group[s.name][...]
+                    try:
+                        v = group[s.name][...]
+                    except Exception, e:
+                        _LOG.error('Could not access {}/{}: {}'.format(
+                                group.name, s.name, e))
+                        raise
                     if isinstance(v, _numpy.ndarray):
                         if isinstance(s, _config.BooleanSetting):
                             v = bool(v)  # array(True, dtype=bool) -> True