Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9345995
D4546.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D4546.diff
View Options
diff --git a/swh/core/api/__init__.py b/swh/core/api/__init__.py
--- a/swh/core/api/__init__.py
+++ b/swh/core/api/__init__.py
@@ -315,19 +315,15 @@
if status_class == 4:
data = self._decode_response(response, check_status=False)
if isinstance(data, dict):
+ # TODO: remove "exception" field check once all servers
+ # are using new schema
+ exc_data = data["exception"] if "exception" in data else data
for exc_type in self.reraise_exceptions:
- if exc_type.__name__ == data["type"]:
- exception = exc_type(*data["args"])
+ if exc_type.__name__ == exc_data["type"]:
+ exception = exc_type(*exc_data["args"])
break
else:
- # old dict encoded exception schema
- # TODO: Remove that code once all servers are using new schema
- if "exception" in data:
- exception = RemoteException(
- payload=data["exception"], response=response
- )
- else:
- exception = RemoteException(payload=data, response=response)
+ exception = RemoteException(payload=exc_data, response=response)
else:
exception = pickle.loads(data)
@@ -335,14 +331,11 @@
data = self._decode_response(response, check_status=False)
if "exception_pickled" in data:
exception = pickle.loads(data["exception_pickled"])
- # old dict encoded exception schema
- # TODO: Remove that code once all servers are using new schema
- elif "exception" in data:
- exception = RemoteException(
- payload=data["exception"], response=response
- )
else:
- exception = RemoteException(payload=data, response=response)
+ # TODO: remove "exception" field check once all servers
+ # are using new schema
+ exc_data = data["exception"] if "exception" in data else data
+ exception = RemoteException(payload=exc_data, response=response)
except (TypeError, pickle.UnpicklingError):
raise RemoteException(payload=data, response=response)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 3:39 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3226573
Attached To
D4546: test_rpc_client: Add missing RPCClient exception handling tests
Event Timeline
Log In to Comment