QuickDID is a high-performance AT Protocol identity resolution service written in Rust. It provides handle-to-DID resolution with Redis-backed caching and queue processing.

refactor: error cleanup

+7 -7
+7 -7
src/handle_resolution_result.rs
··· 12 12 #[derive(Debug, Error)] 13 13 pub enum HandleResolutionError { 14 14 #[error("error-quickdid-resolution-1 System time error: {0}")] 15 - SystemTimeError(String), 15 + SystemTime(String), 16 16 17 17 #[error("error-quickdid-serialization-1 Failed to serialize resolution result: {0}")] 18 - SerializationError(String), 18 + Serialization(String), 19 19 20 20 #[error("error-quickdid-serialization-2 Failed to deserialize resolution result: {0}")] 21 - DeserializationError(String), 21 + Deserialization(String), 22 22 } 23 23 24 24 /// Represents the type of DID method from a resolution ··· 51 51 pub fn success(did: &str) -> Result<Self, HandleResolutionError> { 52 52 let timestamp = SystemTime::now() 53 53 .duration_since(UNIX_EPOCH) 54 - .map_err(|e| HandleResolutionError::SystemTimeError(e.to_string()))? 54 + .map_err(|e| HandleResolutionError::SystemTime(e.to_string()))? 55 55 .as_secs(); 56 56 57 57 let (method_type, payload) = Self::parse_did(did); ··· 67 67 pub fn not_resolved() -> Result<Self, HandleResolutionError> { 68 68 let timestamp = SystemTime::now() 69 69 .duration_since(UNIX_EPOCH) 70 - .map_err(|e| HandleResolutionError::SystemTimeError(e.to_string()))? 70 + .map_err(|e| HandleResolutionError::SystemTime(e.to_string()))? 71 71 .as_secs(); 72 72 73 73 Ok(Self { ··· 105 105 /// Serialize the result to bytes using bincode 106 106 pub fn to_bytes(&self) -> Result<Vec<u8>, HandleResolutionError> { 107 107 bincode::serde::encode_to_vec(self, bincode::config::standard()) 108 - .map_err(|e| HandleResolutionError::SerializationError(e.to_string())) 108 + .map_err(|e| HandleResolutionError::Serialization(e.to_string())) 109 109 } 110 110 111 111 /// Deserialize from bytes using bincode 112 112 pub fn from_bytes(bytes: &[u8]) -> Result<Self, HandleResolutionError> { 113 113 bincode::serde::decode_from_slice(bytes, bincode::config::standard()) 114 114 .map(|(result, _)| result) 115 - .map_err(|e| HandleResolutionError::DeserializationError(e.to_string())) 115 + .map_err(|e| HandleResolutionError::Deserialization(e.to_string())) 116 116 } 117 117 } 118 118