aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2014-07-09 18:22:18 +0300
committerFilipp Lepalaan <filipp@mac.com>2014-07-09 18:22:18 +0300
commit4205a0bc86af65fc4554de01cfcd21ed5b2b4c01 (patch)
treeea40c2a9fdd3a7093477639bcf76bc734c189b7a
parent5652c5955593b1118f8b3d496c84fba4f164129c (diff)
downloadpy-gsxws-4205a0bc86af65fc4554de01cfcd21ed5b2b4c01.tar.gz
py-gsxws-4205a0bc86af65fc4554de01cfcd21ed5b2b4c01.tar.bz2
py-gsxws-4205a0bc86af65fc4554de01cfcd21ed5b2b4c01.zip
Catch unknown GSX errors
-rw-r--r--gsxws/core.py8
1 files changed, 7 insertions, 1 deletions
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)