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

Merged
merged 1 commit into from
Oct 24, 2024
Merged

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
Copy link
Collaborator

@tabaktoni tabaktoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

(regarding re-regeneration we can resolve this in the future)

@ivpavici ivpavici merged commit 947e8b4 into develop Oct 24, 2024
3 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 24, 2024
# [6.16.0](v6.15.0...v6.16.0) (2024-10-24)

### Features

* increase rpc error information propagation ([#1213](#1213)) ([947e8b4](947e8b4))
Copy link

🎉 This issue has been resolved in version 6.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants