summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-03-25 22:32:00 -0500
committerNathan Binkert <binkertn@umich.edu>2005-03-25 22:32:00 -0500
commit7e1995a29c25e174dda2eafc7980e0a0770133d8 (patch)
tree7bd2836b282a984914ec78ee3997a395e5d8b985 /python
parent59f43580bc2d42b4975af8df56e795c6f63f8310 (diff)
downloadgem5-7e1995a29c25e174dda2eafc7980e0a0770133d8.tar.xz
Better exceptions in python config
python/m5/config.py: Don't raise a new exception, just modify and re-raise the old one. --HG-- extra : convert_revision : 47f6da3a8cb2ee18a6b400863e7ea80ab0c9a5ea
Diffstat (limited to 'python')
-rw-r--r--python/m5/config.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/python/m5/config.py b/python/m5/config.py
index 1af2c5e3e..3b5d94b15 100644
--- a/python/m5/config.py
+++ b/python/m5/config.py
@@ -433,8 +433,10 @@ classes. You're trying to derive from:
try:
param.valid(value)
except Exception, e:
- raise e.__class__, "%s\nError setting param %s.%s to %s\n" % \
+ msg = "%s\nError setting param %s.%s to %s\n" % \
(e, cls.__name__, attr, value)
+ e.args = (msg, )
+ raise
cls._values[attr] = value
elif isConfigNode(value) or isSimObjSequence(value):
cls._values[attr] = value
@@ -510,8 +512,10 @@ classes. You're trying to derive from:
instance.params.append(p)
instance.param_names[pname] = p
except Exception, e:
- raise e.__class__, 'Exception while evaluating %s.%s\n%s' % \
+ msg = 'Exception while evaluating %s.%s\n%s' % \
(instance.path, pname, e)
+ e.args = (msg, )
+ raise
return instance
@@ -693,8 +697,10 @@ class Node(object):
else:
param.value = self.unproxy(pval, ptype)
except Exception, e:
- raise e.__class__, 'Error while fixing up %s:%s\n%s' % \
+ msg = 'Error while fixing up %s:%s\n%s' % \
(self.path, param.name, e)
+ e.args = (msg, )
+ raise
for child in self.children:
assert(child != self)
@@ -727,8 +733,9 @@ class Node(object):
value = param.convert(param.value)
string = param.string(value)
except Exception, e:
- raise e.__class__, 'exception in %s:%s\n%s' % \
- (self.path, param.name, e)
+ msg = 'exception in %s:%s\n%s' % (self.path, param.name, e)
+ e.args = (msg, )
+ raise
print '%s = %s' % (param.name, string)
@@ -760,9 +767,10 @@ class Node(object):
value = param.convert(param.value)
string = param.string(value)
except Exception, e:
- raise e.__class__, 'exception in %s:%s\n%s' % \
- (self.name, param.name, e)
+ msg = 'exception in %s:%s\n%s' % (self.name, param.name, e)
+ e.args = (msg, )
raise
+
if isConfigNode(param.ptype) and string != "Null":
simobjs.append(string)
else: