diff options
author | Filipp Lepalaan <filipp@mac.com> | 2014-07-09 18:22:18 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2014-07-09 18:22:18 +0300 |
commit | 4205a0bc86af65fc4554de01cfcd21ed5b2b4c01 (patch) | |
tree | ea40c2a9fdd3a7093477639bcf76bc734c189b7a | |
parent | 5652c5955593b1118f8b3d496c84fba4f164129c (diff) | |
download | py-gsxws-4205a0bc86af65fc4554de01cfcd21ed5b2b4c01.tar.gz py-gsxws-4205a0bc86af65fc4554de01cfcd21ed5b2b4c01.tar.bz2 py-gsxws-4205a0bc86af65fc4554de01cfcd21ed5b2b4c01.zip |
Catch unknown GSX errors
-rw-r--r-- | gsxws/core.py | 8 |
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) |