mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-02-10 17:03:12 +00:00
chore: shorten error name
This commit is contained in:
parent
c240450fb7
commit
4fa24bd2b7
@ -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)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user