From 4205a0bc86af65fc4554de01cfcd21ed5b2b4c01 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 9 Jul 2014 18:22:18 +0300 Subject: Catch unknown GSX errors --- gsxws/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gsxws/core.py b/gsxws/core.py index 548e17b..413e3fe 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -173,7 +173,10 @@ class GsxError(Exception): @property def code(self): - return self.codes[0] + try: + return self.codes[0] + except IndexError: + return u'XXX' @property def message(self): @@ -184,6 +187,9 @@ class GsxError(Exception): return dict(zip(self.codes, self.messages)) def __unicode__(self): + if len(self.messages) < 1: + return u'Unknown GSX error' + return u' '.join(self.messages) -- cgit v1.2.3