chore: rename error message (#247)

This commit is contained in:
Nathan.fooo 2024-01-05 07:29:06 +08:00 committed by GitHub
parent 8e38ae7b69
commit 4886d3d474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View File

@ -89,7 +89,7 @@ pub trait CollabStorage: Send + Sync + 'static {
/// # Returns
///
/// * `Result<RawData>` - Returns the data of the collaboration if found, `Err` otherwise.
async fn get_collab_encoded_v1(
async fn get_collab_encoded(
&self,
uid: &i64,
params: QueryCollabParams,
@ -150,7 +150,7 @@ where
self.as_ref().insert_collab(uid, params).await
}
async fn get_collab_encoded_v1(
async fn get_collab_encoded(
&self,
uid: &i64,
params: QueryCollabParams,
@ -158,7 +158,7 @@ where
) -> DatabaseResult<EncodedCollab> {
self
.as_ref()
.get_collab_encoded_v1(uid, params, force_from_disk)
.get_collab_encoded(uid, params, force_from_disk)
.await
}
@ -255,7 +255,7 @@ impl CollabStorage for CollabStoragePgImpl {
Ok(())
}
async fn get_collab_encoded_v1(
async fn get_collab_encoded(
&self,
_uid: &i64,
params: QueryCollabParams,
@ -268,9 +268,8 @@ impl CollabStorage for CollabStoragePgImpl {
)
.await
{
Ok(data) => EncodedCollab::decode_from_bytes(&data).map_err(|err| {
AppError::Internal(anyhow!("fail to decode data to EncodedDocV1: {:?}", err))
}),
Ok(data) => EncodedCollab::decode_from_bytes(&data)
.map_err(|err| AppError::Internal(anyhow!("fail to decode data to EncodedDoc: {:?}", err))),
Err(e) => match e {
sqlx::Error::RowNotFound => {
let msg = format!("Can't find the row for query: {:?}", params);

View File

@ -175,7 +175,7 @@ where
match self
.storage
.get_collab_encoded_v1(&self.uid, params, true)
.get_collab_encoded(&self.uid, params, true)
.await
{
Ok(encoded_collab_v1) => match init_collab_with_raw_data(object_id, &encoded_collab_v1, doc)

View File

@ -291,7 +291,7 @@ async fn get_collab_handler(
.map_err(AppResponseError::from)?;
let data = state
.collab_storage
.get_collab_encoded_v1(&uid, payload.into_inner(), false)
.get_collab_encoded(&uid, payload.into_inner(), false)
.await
.map_err(AppResponseError::from)?;
@ -326,7 +326,7 @@ async fn create_collab_snapshot_handler(
.map_err(AppResponseError::from)?;
let encoded_collab_v1 = state
.collab_storage
.get_collab_encoded_v1(
.get_collab_encoded(
&uid,
QueryCollabParams::new(&object_id, collab_type, &workspace_id),
false,

View File

@ -142,7 +142,7 @@ where
self.inner.insert_collab(uid, params).await
}
async fn get_collab_encoded_v1(
async fn get_collab_encoded(
&self,
uid: &i64,
params: QueryCollabParams,
@ -172,7 +172,7 @@ where
"Get collab data:{} from disk",
params.object_id
);
self.inner.get_collab_encoded_v1(uid, params, true).await
self.inner.get_collab_encoded(uid, params, true).await
},
Some(collab) => {
event!(