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

feat: increase rpc error information propagation #1213

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

penovicp
Copy link
Collaborator

@penovicp penovicp commented Sep 2, 2024

Motivation and Resolution

The aim of this PR is to make the structured RPC error information more accessible which should enable more nuanced error handling.

Usage and development related changes

A new RpcError class is introduced which exposes the RPC error information through its properties. It also contains an isType() convenience method which can be used as follows:

try {
  ...
} catch (error) {
  if (error instanceof RpcError && error.isType('CONTRACT_NOT_FOUND')) { ... }
}

RpcError is a subclass of LibraryError that uses the same error message format as the current implementation so the changes are backward compatible.

Checklist:

  • Performed a self-review of the code
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Linked the issues which this PR resolves
  • Documented the changes in code (API docs will be generated automatically)
  • Updated the tests
  • All tests are passing

@penovicp penovicp marked this pull request as ready for review September 18, 2024 06:52
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.

2 participants