Make inner_exception optional, and use new except syntax.

main
Vincent Driessen 12 years ago
parent 2baa2e370f
commit 67880343f1

@ -11,6 +11,6 @@ class NoQueueError(Exception):
class UnpickleError(Exception): class UnpickleError(Exception):
def __init__(self, message, raw_data, inner_exception): def __init__(self, message, raw_data, inner_exception=None):
super(UnpickleError, self).__init__(message, inner_exception) super(UnpickleError, self).__init__(message, inner_exception)
self.raw_data = raw_data self.raw_data = raw_data

@ -27,7 +27,7 @@ def unpickle(pickled_string):
""" """
try: try:
obj = loads(pickled_string) obj = loads(pickled_string)
except (StandardError, UnpicklingError), e: except (StandardError, UnpicklingError) as e:
raise UnpickleError('Could not unpickle.', pickled_string, e) raise UnpickleError('Could not unpickle.', pickled_string, e)
return obj return obj

Loading…
Cancel
Save