chore: shorten error name

This commit is contained in:
kaichaosun 2026-01-28 17:57:05 +08:00
parent c240450fb7
commit 4fa24bd2b7
No known key found for this signature in database
GPG Key ID: 223E0F992F4F03BF
2 changed files with 5 additions and 11 deletions

View File

@ -88,7 +88,7 @@ impl<'a, D: HkdfInfo + Clone> RatchetSession<'a, D> {
remote_pub: PublicKey, remote_pub: PublicKey,
) -> Result<Self, StorageError> { ) -> Result<Self, StorageError> {
if storage.exists(conversation_id)? { if storage.exists(conversation_id)? {
return Err(StorageError::ConversationAlreadyExists); return Err(StorageError::ConvAlreadyExists);
} }
let state = RatchetState::<D>::init_sender(shared_secret, remote_pub); let state = RatchetState::<D>::init_sender(shared_secret, remote_pub);
Self::create(storage, conversation_id, state) Self::create(storage, conversation_id, state)
@ -102,7 +102,7 @@ impl<'a, D: HkdfInfo + Clone> RatchetSession<'a, D> {
dh_self: InstallationKeyPair, dh_self: InstallationKeyPair,
) -> Result<Self, StorageError> { ) -> Result<Self, StorageError> {
if storage.exists(conversation_id)? { if storage.exists(conversation_id)? {
return Err(StorageError::ConversationAlreadyExists); return Err(StorageError::ConvAlreadyExists);
} }
let state = RatchetState::<D>::init_receiver(shared_secret, dh_self); let state = RatchetState::<D>::init_receiver(shared_secret, dh_self);
@ -342,10 +342,7 @@ mod tests {
bob_pub.clone(), bob_pub.clone(),
); );
assert!(matches!( assert!(matches!(result, Err(StorageError::ConvAlreadyExists)));
result,
Err(StorageError::ConversationAlreadyExists)
));
} }
} }
@ -378,10 +375,7 @@ mod tests {
another_keypair, another_keypair,
); );
assert!(matches!( assert!(matches!(result, Err(StorageError::ConvAlreadyExists)));
result,
Err(StorageError::ConversationAlreadyExists)
));
} }
} }
} }

View File

@ -29,7 +29,7 @@ pub enum StorageError {
/// Database already exists. /// Database already exists.
#[error("conversation already exists")] #[error("conversation already exists")]
ConversationAlreadyExists, ConvAlreadyExists,
} }
impl From<rusqlite::Error> for StorageError { impl From<rusqlite::Error> for StorageError {