refactor(errors): finish thiserror migration and demote anyhow to dev-deps - #674
Open
varex83agent wants to merge 1 commit into
Open
refactor(errors): finish thiserror migration and demote anyhow to dev-deps#674varex83agent wants to merge 1 commit into
varex83agent wants to merge 1 commit into
Conversation
…-deps Closes #612. Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
iamquang95
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #612.
Replaced the hand-written
Display/std::error::Errorimpls with#[derive(thiserror::Error)]forpeerinfo::Failure,app::SharedStepError,p2p::PeerNotAllowed, anddkg::SenderPeerMismatch(Display strings preserved verbatim;#[source]added where a cause was previously exposed). Added#[source]to the five source-carryingK1UtilErrorvariants and, from the workspace sweep, the fivepluto_crypto::types::Errorvariants wrappingBlsError(identical pattern, in-scope crate). Replaced featureset's twoTryFrom<&str>type Error = Stringimpls with typedParseStatusError/ParseFeatureError(same rendered messages) and switchedbeacon.rsto the typedCliError::TestCaseNotSupported(message text "test case not supported" unchanged, asserted-on tests still pass).Skipped / already-done, noted here rather than guessed:
validatorapi::ApiErrorwas NOT converted: its Display is conditional (renders the source inline only when present), which thiserror 2.0 can only express via#[error(fmt = ...)]on enums — not structs. Keeping a hand-writtenDisplay+Errorwas the only way to preserve the exact output, so the manual impls remain. This is a public-facing message contract, not worth a lossy rewrite.anyhowdemotion:consensus,p2p,parsigex,peerinfo, anddkgalready declareanyhowonly under[dev-dependencies]onmain(verifiedsrc/non-test has zeroanyhow; dkg's uses are all in#[cfg(test)]modules), so noCargo.tomlchanges were needed.From<BLST_ERROR> for Error/Error::BlsError: no longer present incrates/crypto/src/types.rs; onlyFrom<BLST_ERROR> for BlsErrorexists and BLST failures are already routed to typedErrorvariants at each call site, so there was nothing to re-route.{0}-without-#[source]pattern in ssz/cluster/eth2util/consensus; left untouched to keep the change scoped to the issue's crate list.eth2apideliberately untouched (out of scope, #611).Quality gates (affected crates):
cargo +nightly fmt --all --check,cargo clippy ... -D warnings, andcargo test --all-featuresall pass.Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com