summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2015-04-06 13:42:12 -0700
committerKevin Greenan <kmg@box.com>2015-04-06 13:42:12 -0700
commit041d44311bf3d7d3f655dfc6c692d8693b9e0634 (patch)
tree41bba19cacc01117cec49744344d5dab238eddfc
parent88c46cc3ac30fca2204080ba2af99f66e7bf8acf (diff)
downloadpyeclib-041d44311bf3d7d3f655dfc6c692d8693b9e0634.tar.gz
Handle non-string arguments in the base PyECLib exception constructor.v1.0.7m
-rw-r--r--pyeclib/ec_iface.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pyeclib/ec_iface.py b/pyeclib/ec_iface.py
index fbe82f0..493ea82 100644
--- a/pyeclib/ec_iface.py
+++ b/pyeclib/ec_iface.py
@@ -112,13 +112,15 @@ class PyECLib_FRAGHDRCHKSUM_Types(PyECLibEnum):
# Generic ECDriverException
class ECDriverError(Exception):
- def __init__(self, error_str):
- self.error_str = error_str
-
+ def __init__(self, error):
+ try:
+ self.error_str = str(error)
+ except:
+ self.error_str = 'Error retrieving the error message from %s' \
+ % error.__class__.__name__
def __str__(self):
return self.error_str
-
# Main ECDriver class
class ECDriver(object):