From ed0fa7c799ccec87b44380ec0eb1604e75f9e02c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 8 Jun 2014 10:58:44 +0100 Subject: [PATCH] Don't hard-code the message. --- wolframalpha/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wolframalpha/__init__.py b/wolframalpha/__init__.py index e991559..315068e 100644 --- a/wolframalpha/__init__.py +++ b/wolframalpha/__init__.py @@ -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'))