refactor: reduce map_err boilerplate with context helper methods (TODO-025)

Add per-crate variant_ctx() helper methods to StorageError, BlobCacheError,
ProtocolError, and BridgeError. Replace 78 .map_err(|e| format!(...))
closures with concise context calls. Identical error messages preserved.
This commit is contained in:
Edison Jwa
2026-06-11 12:25:00 +09:00
parent 1efeaac19d
commit 40883c40c8
4 changed files with 89 additions and 49 deletions
+6
View File
@@ -98,6 +98,12 @@ pub enum BridgeError {
Unmapped(String),
}
impl BridgeError {
fn unmapped_ctx(ctx: impl std::fmt::Display, e: impl std::fmt::Display) -> Self {
BridgeError::Unmapped(format!("{ctx}: {e}"))
}
}
impl From<chanora_core::CoreError> for BridgeError {
fn from(e: chanora_core::CoreError) -> Self {
match e {