Skip to content

refactor: Use error types from rpc-spec - #3173

Merged
godexsoft merged 14 commits into
XRPLF:developfrom
godexsoft:refactor/consteval-specs-move-errors
Sep 8, 2026
Merged

refactor: Use error types from rpc-spec#3173
godexsoft merged 14 commits into
XRPLF:developfrom
godexsoft:refactor/consteval-specs-move-errors

Conversation

@godexsoft

Copy link
Copy Markdown
Collaborator

This is PR 3 out of many. It depends on merging #3171 first.

Moves the RPC error model into the shared spec library. src/rpc/Errors.hpp becomes a shim over <rpcspec/Errors.hpp>, keeping only the Clio-side rendering: makeError, getErrorInfo, getEtlErrorInfo.

ClioError::Etl* is carved out into a Clio-side etl::EtlError (new src/etl/Errors.hpp), since ETL codes aren't an RPC-spec concern. Source::forwardToRippled now returns EtlError instead of ClioError, which is what most of the diff is.

Wire-visible change: the "clio only serves validated data" warning now says "if you want to talk to xrpld" instead of "rippled" — the string moved into rpcspec, which renamed it. 10 expectations updated in RPCServerHandlerTests.cpp.

Drive-by cleanups:

  • Deleted InvalidParamsError and AccountNotFoundError - unreferenced anywhere in src/ or tests/.
  • Both error-info tables become std::to_array + ranges::find with a projection.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/etl/impl/ForwardingSource.cpp 80.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@godexsoft
godexsoft requested a review from mathbunnyru August 26, 2026 16:07
Comment thread src/etl/Errors.hpp Outdated
Comment thread src/etl/CMakeLists.txt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors Clio’s RPC error handling to rely on the shared xrpl-rpc-spec error model, keeping Clio-specific rendering helpers and updating call sites/tests to use the spec types and renamed forwarding error codes.

Changes:

  • Replaced most direct usage of Clio-defined RPC error types with <rpcspec/Errors.hpp> and updated forwarding-related errors from Etl* to RpcForwarding*.
  • Updated the wire-visible “validated data” warning text to reference xrpld instead of rippled, and adjusted unit tests accordingly.
  • Bumped xrpl-rpc-spec dependency to 0.1.7 and linked rpcspec::rpcspec where needed.

Reviewed changes

Copilot reviewed 84 out of 85 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/web/RPCServerHandlerTests.cpp Update warning message expectation; switch to rpcspec header include.
tests/unit/web/ng/RPCServerHandlerTests.cpp Replace Clio Errors include with rpcspec include.
tests/unit/web/ng/impl/ErrorHandlingTests.cpp Replace Clio Errors include with rpcspec include.
tests/unit/web/LoadWarningTests.cpp Replace Clio Errors include with rpcspec include.
tests/unit/web/impl/ErrorHandlingTests.cpp Replace Clio Errors include with rpcspec include.
tests/unit/rpc/RPCHelpersTests.cpp Add rpcspec errors include for updated error model.
tests/unit/rpc/RPCEngineTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/VaultInfoTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/UnsubscribeTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/TxTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/TestHandlerTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/SubscribeTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/ServerInfoTests.cpp Add rpcspec errors include; update forwarding error expectations.
tests/unit/rpc/handlers/LedgerTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/LedgerEntryTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/LedgerDataTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/CredentialHelpersTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/AccountOffersTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/AccountLinesTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/AccountInfoTests.cpp Add rpcspec errors include.
tests/unit/rpc/handlers/AccountCurrenciesTests.cpp Add rpcspec errors include.
tests/unit/rpc/ForwardingProxyTests.cpp Switch to rpcspec errors include; update forwarding error expectations.
tests/unit/rpc/ErrorTests.cpp Add rpcspec errors include; update warning text and forwarding error codes.
tests/unit/rpc/common/TypesTests.cpp Drop direct Clio Errors include (Types already pulls it in).
tests/unit/rpc/common/SpecsTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/common/CheckersTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/BaseTests.cpp Switch to rpcspec errors include.
tests/unit/etl/SourceImplTests.cpp Switch to rpcspec errors include.
tests/unit/etl/LoadBalancerTests.cpp Switch to rpcspec errors include; update forwarding error expectations.
tests/unit/etl/ForwardingSourceTests.cpp Switch to rpcspec errors include; update forwarding error expectations.
tests/unit/etl/ETLStateTests.cpp Switch to rpcspec errors include; update forwarding error expectations.
tests/unit/app/WebHandlersTests.cpp Switch to rpcspec errors include.
tests/common/util/MockSource.hpp Switch to rpcspec errors include.
src/web/ng/impl/ErrorHandling.cpp Update forwarding error enum names; include rpcspec errors.
src/web/impl/ErrorHandling.hpp Update forwarding error enum names.
src/web/CMakeLists.txt Link rpcspec library into web target.
src/rpc/RPCHelpers.cpp Switch to rpcspec errors include.
src/rpc/handlers/VaultInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/Unsubscribe.cpp Switch to rpcspec errors include.
src/rpc/handlers/TransactionEntry.cpp Switch to rpcspec errors include.
src/rpc/handlers/Subscribe.cpp Switch to rpcspec errors include.
src/rpc/handlers/NoRippleCheck.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTsByIssuer.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTOffersCommon.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTHistory.cpp Switch to rpcspec errors include.
src/rpc/handlers/MPTokenIssuanceHistory.cpp Switch to rpcspec errors include.
src/rpc/handlers/MPTHolders.cpp Switch to rpcspec errors include.
src/rpc/handlers/LedgerIndex.cpp Switch to rpcspec errors include.
src/rpc/handlers/LedgerEntry.cpp Switch to rpcspec errors include.
src/rpc/handlers/LedgerData.cpp Switch to rpcspec errors include.
src/rpc/handlers/GetAggregatePrice.cpp Remove Clio Errors include (no longer needed).
src/rpc/handlers/GatewayBalances.cpp Switch to rpcspec errors include.
src/rpc/handlers/Feature.cpp Switch to rpcspec errors include.
src/rpc/handlers/DepositAuthorized.cpp Switch to rpcspec errors include.
src/rpc/handlers/AMMInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountTx.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountOffers.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountObjects.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountNFTs.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountMPTokens.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountMPTokenIssuances.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountLines.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountCurrencies.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountChannels.cpp Switch to rpcspec errors include.
src/rpc/Factories.cpp Switch to rpcspec errors include.
src/rpc/Errors.hpp Convert to shim over rpcspec errors; keep Clio-side rendering surface.
src/rpc/Errors.cpp Move remaining Clio-only error-info table; use std::to_array/ranges::find; update forwarding error names.
src/rpc/CredentialHelpers.cpp Switch to rpcspec errors include.
src/rpc/common/Validators.cpp Switch to rpcspec errors include.
src/rpc/common/Specs.hpp Docstring tweaks referencing Status.
src/rpc/common/Specs.cpp Switch to rpcspec errors include.
src/rpc/common/MetaProcessors.cpp Switch to rpcspec errors include.
src/rpc/common/AnyHandler.hpp Docstring tweak referencing Status.
src/feed/CMakeLists.txt Link rpcspec library into feed target.
src/etl/Source.hpp Switch to rpcspec errors include for forwarding error type usage.
src/etl/LoadBalancer.cpp Update default forwarding error code to renamed RpcForwarding*.
src/etl/impl/SourceImpl.hpp Switch to rpcspec errors include.
src/etl/impl/ForwardingSource.hpp Switch to rpcspec errors include.
src/etl/impl/ForwardingSource.cpp Rename forwarding error returns to RpcForwarding*.
src/etl/CMakeLists.txt Link rpcspec library into etl target.
src/app/WebHandlers.cpp Add rpcspec errors include.
conanfile.py Bump xrpl-rpc-spec dependency to 0.1.7.
conan.lock Update lockfile entry for xrpl-rpc-spec/0.1.7.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/etl/Source.hpp
Comment thread src/app/WebHandlers.cpp
Comment thread src/etl/impl/ForwardingSource.cpp
Comment thread src/rpc/common/AnyHandler.hpp
Comment thread src/rpc/Errors.cpp
@godexsoft
godexsoft merged commit db12445 into XRPLF:develop Sep 8, 2026
120 checks passed
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.

3 participants