diff options
author | Kevin Greenan <kmg@box.com> | 2015-04-06 13:42:12 -0700 |
---|---|---|
committer | Kevin Greenan <kmg@box.com> | 2015-04-06 13:42:12 -0700 |
commit | 041d44311bf3d7d3f655dfc6c692d8693b9e0634 (patch) | |
tree | 41bba19cacc01117cec49744344d5dab238eddfc | |
parent | 88c46cc3ac30fca2204080ba2af99f66e7bf8acf (diff) | |
download | pyeclib-041d44311bf3d7d3f655dfc6c692d8693b9e0634.tar.gz |
Handle non-string arguments in the base PyECLib exception constructor.v1.0.7m
-rw-r--r-- | pyeclib/ec_iface.py | 10 |
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): |