From 041d44311bf3d7d3f655dfc6c692d8693b9e0634 Mon Sep 17 00:00:00 2001 From: Kevin Greenan Date: Mon, 6 Apr 2015 13:42:12 -0700 Subject: Handle non-string arguments in the base PyECLib exception constructor. --- pyeclib/ec_iface.py | 10 ++++++---- 1 file 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): -- cgit v1.2.1