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

Better LP/Broker API RPC Errors #3931

Merged
merged 5 commits into from
Sep 5, 2023
Merged

Better LP/Broker API RPC Errors #3931

merged 5 commits into from
Sep 5, 2023

Conversation

dandanlen
Copy link
Collaborator

@dandanlen dandanlen commented Aug 31, 2023

Pull Request

Closes: PRO-808

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

  • Updated jsonrpsee because this PR changes the way errors are used.
  • Added a wrapper around anyhow::Error to allow conversion to jsonrpsee::types::ErrorObjectOwned including context and source.

@linear
Copy link

linear bot commented Aug 31, 2023

PRO-808 Better API errors.

We currently use the default error conversion from anyhow::Error.

By default, this uses the "{}" formatter, which only uses the outermost error or context. This means that we often drop useful error messages and only display the context.

For example, lp_registerAccount just shows Could not register account role for account and drops the inner runtime error.

We should include the runtime error message.

@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #3931 (a997a57) into main (0ff654f) will decrease coverage by 0%.
The diff coverage is 0%.

@@          Coverage Diff          @@
##            main   #3931   +/-   ##
=====================================
- Coverage     72%     72%   -0%     
=====================================
  Files        366     366           
  Lines      56783   56789    +6     
  Branches   56783   56789    +6     
=====================================
- Hits       40949   40945    -4     
- Misses     13747   13756    +9     
- Partials    2087    2088    +1     
Files Changed Coverage Δ
api/lib/src/lp.rs 0% <0%> (ø)
engine/src/dot/http_rpc.rs 0% <0%> (ø)
engine/src/eth/rpc.rs 0% <0%> (ø)
utilities/src/with_std.rs 50% <0%> (-1%) ⬇️

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@j4m1ef0rd j4m1ef0rd self-assigned this Sep 5, 2023
@j4m1ef0rd j4m1ef0rd marked this pull request as ready for review September 5, 2023 06:18
@j4m1ef0rd j4m1ef0rd changed the title feat: LpErrorExt Better LP/Broker RPC Errors Sep 5, 2023
@j4m1ef0rd j4m1ef0rd changed the title Better LP/Broker RPC Errors Better LP/Broker API RPC Errors Sep 5, 2023
Copy link
Collaborator Author

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

Thanks @j4m1ef0rd , LGTM.

@dandanlen dandanlen enabled auto-merge (squash) September 5, 2023 12:26
@dandanlen dandanlen merged commit e32d244 into main Sep 5, 2023
42 checks passed
@dandanlen dandanlen deleted the feat/better-api-errors branch September 5, 2023 12:59
dandanlen added a commit that referenced this pull request Sep 6, 2023
Co-authored-by: Jamie Ford <Jamie@chainflip.io>
dandanlen added a commit that referenced this pull request Sep 6, 2023
Co-authored-by: Jamie Ford <Jamie@chainflip.io>
syan095 added a commit that referenced this pull request Sep 8, 2023
…on-integration

* origin/main:
  fix: scale encoding skip phantom data (#3967)
  chore: make platform team code owner of CI settings.toml and localnet (#3957)
  fix: prefer finalize_signed_extrinsic in engine (#3956)
  fix: CanonicalAssetPair encoding issue (#3958)
  chore(bouncer): Update sdk to 0.0.40 (#3945)
  fix: tweak cli generate-keys output (#3943)
  chore: add `preinst` script unit tests 🧪 (#3942)
  Better LP/Broker API RPC Errors (#3931)
  fix: update substrate ref to use Kademlia fix (#3941)
  doc: update funding readme with redemption restrictions (#3914)
  feat: PRO-474 broadcast safe mode (#3902)
  feat: more forgiving dot address parsing (#3938)
  fix: duplicate logging (#3939)
  feat: new lp interface (#3886)

# Conflicts:
#	Cargo.lock
#	state-chain/cf-integration-tests/Cargo.toml
#	state-chain/cf-integration-tests/src/authorities.rs
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