Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethrow exceptions across RPC boundary #353

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

tom-binary
Copy link
Contributor

If an RPC call fails, the details are placed in the error response.

If we're using ->call_rpc or other wrapper mechanisms, we want those to fail in those cases, so this adds a check for the {error} key and uses that to construct an InternalException instance. Note that the precise details of the exception are likely to change to accommodate the interoperability requirements for other languages: ideally we'd always raise the same exception class and details as the upstream service threw, but also need to be careful about the following cases:

  • custom code in the exception object that isn't available on the caller
  • internal errors which should be distinguishable from application errors

For these reasons, we start with an InternalException instance in all cases, since we expect calling code to be able to handle that (it can be raised regardless of what the called code is going to do, for example to indicate a transport error). Future updates are likely to add other possible exception responses giving a closer match to the original exception.

@tom-binary tom-binary merged commit 761a3d5 into deriv-com:master Oct 22, 2024
1 check passed
@tom-binary tom-binary deleted the feature/rpc_exception branch October 22, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant