summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-12-19 02:07:06 -0500
committerNathan Binkert <binkertn@umich.edu>2005-12-19 02:07:06 -0500
commit45ecb2b69e377dfb7e2080347d560420607f18ba (patch)
tree2876279808193286fcd9f660e7f042d1315a6910
parentadf47c95b0e1cdea9f17569f6c26a118f32f574b (diff)
downloadgem5-45ecb2b69e377dfb7e2080347d560420607f18ba.tar.xz
Create the ProxyError Exception. Raise it when an unproxy
operation fails because information is wrong or not available. --HG-- extra : convert_revision : 1fd90c1291618b09752179cfa6894f1df495fffd
-rw-r--r--util/stats/info.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/util/stats/info.py b/util/stats/info.py
index 1f9f11940..4cb55f564 100644
--- a/util/stats/info.py
+++ b/util/stats/info.py
@@ -27,6 +27,9 @@
from __future__ import division
import operator, re, types
+class ProxyError(Exception):
+ pass
+
def unproxy(proxy):
if hasattr(proxy, '__unproxy__'):
return proxy.__unproxy__()
@@ -336,7 +339,12 @@ class AttrProxy(Proxy):
self.attr = attr
def __unproxy__(self):
- return unproxy(getattr(unproxy(self.proxy), self.attr))
+ proxy = unproxy(self.proxy)
+ try:
+ attr = getattr(proxy, self.attr)
+ except AttributeError, e:
+ raise ProxyError, e
+ return unproxy(attr)
def __str__(self):
return '%s.%s' % (self.proxy, self.attr)