Page MenuHomeSoftware Heritage

In case of errors, return a simple dictionary instead of pickled exception.
ClosedPublic

Authored by vlorentz on Feb 5 2020, 5:12 PM.

Details

Summary

Pros:

  • Language-independent
  • Works with unpickleable exceptions (eg. cimpl.KafkaException, and RLock objects in exceptions raised by tenacity)

Con:

  • Shows a less nice error on the client side (if the client is in Python)

Resolves T2239.

Test Plan

tox passes this repo, but I'm going to try tests with RPC servers that use it.

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz created this revision.Feb 5 2020, 5:12 PM

but I'm going to try tests with RPC servers that use it.

Meh. Of course it doesn't.

starts to look, better ;)

swh/core/api/__init__.py
98

is self.args systematically a list?

284

unsure about removing that statement.
i guess that's the price for not having tests on that part ;)

ardumont accepted this revision.Feb 6 2020, 12:07 PM
This revision is now accepted and ready to land.Feb 6 2020, 12:07 PM
vlorentz added inline comments.Feb 6 2020, 12:09 PM
swh/core/api/__init__.py
98

It's a tuple, but yes

284

It's a bad idea to return None in case an endpoint doesn't exist, anyway.

Note: this diff will stay open for a little while, @ardumont and I have other changes to make before it can be merged

vlorentz updated this revision to Diff 9477.Feb 11 2020, 3:46 PM

Update RPCClient to re-raise whitelisted exceptions types.

This revision was landed with ongoing or failed builds.Feb 14 2020, 12:22 PM
This revision was automatically updated to reflect the committed changes.