From 5f2b3a6e5d38ea257ee7bbe78ef548905f083290 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 22 Mar 2005 14:42:05 -0500 Subject: clean up python exceptions python/m5/config.py: clean up exception output a bit. --HG-- extra : convert_revision : a27e75276ffc9001f44c44595172cf2b455e5e23 --- python/m5/config.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'python/m5') diff --git a/python/m5/config.py b/python/m5/config.py index 68098bf14..8a2a8c275 100644 --- a/python/m5/config.py +++ b/python/m5/config.py @@ -202,6 +202,7 @@ class Proxy(object): raise AttributeError, \ 'Parent of %s type %s not found at path %s' \ % (base.name, ptype, self._path) + result, done = obj.find(ptype, self._path) obj = obj.parent @@ -510,10 +511,9 @@ classes. You're trying to derive from: p = NodeParam(pname, param, value) instance.params.append(p) instance.param_names[pname] = p - except: - print 'Exception while evaluating %s.%s' % \ - (instance.path, pname) - raise + except Exception, e: + raise e.__class__, 'Exception while evaluating %s.%s\n%s' % \ + (instance.path, pname, e) return instance @@ -694,9 +694,9 @@ class Node(object): param.value = [ self.unproxy(pv, ptype) for pv in pval ] else: param.value = self.unproxy(pval, ptype) - except: - print 'Error while fixing up %s:%s' % (self.path, param.name) - raise + except Exception, e: + raise e.__class__, 'Error while fixing up %s:%s\n%s' % \ + (self.path, param.name, e) for child in self.children: assert(child != self) @@ -728,9 +728,9 @@ class Node(object): value = param.convert(param.value) string = param.string(value) - except: - print 'exception in %s:%s' % (self.path, param.name) - raise + except Exception, e: + raise e.__class__, 'exception in %s:%s\n%s' % \ + (self.path, param.name, e) print '%s = %s' % (param.name, string) @@ -763,8 +763,9 @@ class Node(object): value = param.convert(param.value) string = param.string(value) - except: - print 'exception in %s:%s' % (self.name, param.name) + except Exception, e: + raise e.__class__, 'exception in %s:%s\n%s' % \ + (self.name, param.name, e) raise if isConfigNode(param.ptype) and string != "Null": simobjs.append(string) @@ -773,7 +774,8 @@ class Node(object): for so in simobjs: label += "|<%s> %s" % (so, so) - dot.add_edge(pydot.Edge("%s:%s" % (self.path, so), so, tailport="w")) + dot.add_edge(pydot.Edge("%s:%s" % (self.path, so), so, + tailport="w")) label += '}' dot.add_node(pydot.Node(self.path,shape="Mrecord",label=label)) -- cgit v1.2.3