From 4a0965d3f78a76f3456607edcce0237505cff4e5 Mon Sep 17 00:00:00 2001 From: Ramon Date: Tue, 25 Feb 2014 12:22:55 +0100 Subject: [PATCH] Added the result code to the exception Added the result code the exception so that we can use those codes to create our own error messages, useful for example when using mailchimp on a non-english website. A list of possible codes that the Mailchimp API can return, is available here: http://apidocs.mailchimp.com/api/1.3/exceptions.field.php --- mailchimp/chimpy/chimpy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailchimp/chimpy/chimpy.py b/mailchimp/chimpy/chimpy.py index be48db3..8e3f8b2 100644 --- a/mailchimp/chimpy/chimpy.py +++ b/mailchimp/chimpy/chimpy.py @@ -58,7 +58,7 @@ def _rpc(self, method, **params): try: if 'error' in result: - raise ChimpyException("%s:\n%s" % (result['error'], params)) + raise ChimpyException("%s:\n%s" % (result['error'], params), result['code']) except TypeError: # thrown when results is not iterable (eg bool) pass