Don't hard-code the message.

This commit is contained in:
Jason R. Coombs 2014-06-08 10:58:44 +01:00
parent c3b3e69d5d
commit ed0fa7c799

View File

@ -16,7 +16,10 @@ class Result(object):
self.tree = etree.parse(stream)
error = self.tree.find('error')
if error:
raise Exception('you may have entered the wrong appid')
code = error.find('code').text
msg = error.find('msg').text
tmpl = 'Error {code}: {msg}'
raise Exception(tmpl.format(code=code, msg=msg))
def __iter__(self):
return (Pod(node) for node in self.tree.findall('pod'))