Skip to content

refactor(errors): finish thiserror migration and demote anyhow to dev-deps - #674

Open
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-612-finish-thiserror
Open

refactor(errors): finish thiserror migration and demote anyhow to dev-deps#674
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-612-finish-thiserror

Conversation

@varex83agent

Copy link
Copy Markdown
Collaborator

Closes #612.

Replaced the hand-written Display/std::error::Error impls with #[derive(thiserror::Error)] for peerinfo::Failure, app::SharedStepError, p2p::PeerNotAllowed, and dkg::SenderPeerMismatch (Display strings preserved verbatim; #[source] added where a cause was previously exposed). Added #[source] to the five source-carrying K1UtilError variants and, from the workspace sweep, the five pluto_crypto::types::Error variants wrapping BlsError (identical pattern, in-scope crate). Replaced featureset's two TryFrom<&str> type Error = String impls with typed ParseStatusError/ParseFeatureError (same rendered messages) and switched beacon.rs to the typed CliError::TestCaseNotSupported (message text "test case not supported" unchanged, asserted-on tests still pass).

Skipped / already-done, noted here rather than guessed:

  • validatorapi::ApiError was 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-written Display + Error was 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.
  • anyhow demotion: consensus, p2p, parsigex, peerinfo, and dkg already declare anyhow only under [dev-dependencies] on main (verified src/ non-test has zero anyhow; dkg's uses are all in #[cfg(test)] modules), so no Cargo.toml changes were needed.
  • From<BLST_ERROR> for Error / Error::BlsError: no longer present in crates/crypto/src/types.rs; only From<BLST_ERROR> for BlsError exists and BLST failures are already routed to typed Error variants at each call site, so there was nothing to re-route.
  • Workspace sweep found the same {0}-without-#[source] pattern in ssz/cluster/eth2util/consensus; left untouched to keep the change scoped to the issue's crate list.

eth2api deliberately untouched (out of scope, #611).

Quality gates (affected crates): cargo +nightly fmt --all --check, cargo clippy ... -D warnings, and cargo test --all-features all pass.

Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com

…-deps

Closes #612.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
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.

Finish the thiserror migration; demote anyhow to dev-dependencies

3 participants