Skip to content

Commit

Permalink
Merge pull request #356 from k-okada/add_error_check
Browse files Browse the repository at this point in the history
print exception when plugin is not found
  • Loading branch information
fkanehiro committed Oct 10, 2014
2 parents 7df05c8 + 8eeb93b commit 1657376
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions python/hrpsys_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,14 @@ def createComps(self):
Create components(plugins) in getRTCList()
'''
for rn in self.getRTCList():
rn2 = 'self.' + rn[0]
if eval(rn2) == None:
create_str = "[self." + rn[0] + ", self." + rn[0] + "_svc, self." + rn[0] + "_version] = self.createComp(\"" + rn[1] + "\",\"" + rn[0] + "\")"
print self.configurator_name, " eval : ", create_str
exec(create_str)
try:
rn2 = 'self.' + rn[0]
if eval(rn2) == None:
create_str = "[self." + rn[0] + ", self." + rn[0] + "_svc, self." + rn[0] + "_version] = self.createComp(\"" + rn[1] + "\",\"" + rn[0] + "\")"
print self.configurator_name, " eval : ", create_str
exec(create_str)
except Exception, e:
print self.configurator_name, '\033[31mFail to createComps',e,'\033[0m'


def findComp(self, compName, instanceName, max_timeout_count=10):
Expand Down Expand Up @@ -565,7 +568,10 @@ def getRTCInstanceList(self):
'''
ret = [self.rh]
for r in map(lambda x: 'self.' + x[0], self.getRTCList()):
ret.append(eval(r))
try:
ret.append(eval(r))
except Exception, e:
print self.configurator_name, '\033[31mFail to getRTCInstanceList',e,'\033[0m'
return ret

# public method to get bodyInfo
Expand Down

0 comments on commit 1657376

Please sign in to comment.