diff --git a/taskflow/jobs/backends/impl_redis.py b/taskflow/jobs/backends/impl_redis.py index da58267f0..617cad5b4 100644 --- a/taskflow/jobs/backends/impl_redis.py +++ b/taskflow/jobs/backends/impl_redis.py @@ -20,7 +20,6 @@ import threading import time import fasteners -import msgpack from oslo_serialization import msgpackutils from oslo_utils import excutils from oslo_utils import netutils @@ -729,10 +728,7 @@ return cmsgpack.pack(result) def _dumps(obj): try: return msgpackutils.dumps(obj) - except (msgpack.PackException, ValueError): - # TODO(harlowja): remove direct msgpack exception access when - # oslo.utils provides easy access to the underlying msgpack - # pack/unpack exceptions.. + except Exception: exc.raise_with_cause(exc.JobFailure, "Failed to serialize object to" " msgpack blob") @@ -741,10 +737,7 @@ return cmsgpack.pack(result) def _loads(blob, root_types=(dict,)): try: return misc.decode_msgpack(blob, root_types=root_types) - except (msgpack.UnpackException, ValueError): - # TODO(harlowja): remove direct msgpack exception access when - # oslo.utils provides easy access to the underlying msgpack - # pack/unpack exceptions.. + except ValueError: exc.raise_with_cause(exc.JobFailure, "Failed to deserialize object from" " msgpack blob (of length %s)" % len(blob)) diff --git a/taskflow/utils/misc.py b/taskflow/utils/misc.py index b5765c441..ce175af6d 100644 --- a/taskflow/utils/misc.py +++ b/taskflow/utils/misc.py @@ -317,8 +317,6 @@ def decode_msgpack(raw_data, root_types=(dict,)): try: data = msgpackutils.loads(raw_data) except Exception as e: - # TODO(harlowja): fix this when msgpackutils exposes the msgpack - # exceptions so that we can avoid catching just exception... raise ValueError("Expected msgpack decodable data: %s" % e) else: return _check_decoded_type(data, root_types=root_types)