refactor: improve error handling in trie_node method

- Updated the error conversion helper function in ProofTaskTrieNodeProvider to directly wrap the ProviderError, enhancing clarity and maintainability.
- This change simplifies the error handling logic within the trie_node method.
This commit is contained in:
Yong Kang
2025-10-10 12:43:21 +00:00
parent e49791e9ae
commit c02a68dc78

View File

@@ -1082,7 +1082,7 @@ impl TrieNodeProvider for ProofTaskTrieNodeProvider {
fn trie_node(&self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
/// Helper to convert `ProviderError` to `SparseTrieError`
fn provider_err_to_trie_err(e: ProviderError) -> SparseTrieError {
SparseTrieErrorKind::Other(Box::new(std::io::Error::other(e.to_string()))).into()
SparseTrieErrorKind::Other(Box::new(e)).into()
}
/// Helper to convert channel recv error to `SparseTrieError`