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

View File

@ -175,7 +175,7 @@ where
match self match self
.storage .storage
.get_collab_encoded_v1(&self.uid, params, true) .get_collab_encoded(&self.uid, params, true)
.await .await
{ {
Ok(encoded_collab_v1) => match init_collab_with_raw_data(object_id, &encoded_collab_v1, doc) 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)?; .map_err(AppResponseError::from)?;
let data = state let data = state
.collab_storage .collab_storage
.get_collab_encoded_v1(&uid, payload.into_inner(), false) .get_collab_encoded(&uid, payload.into_inner(), false)
.await .await
.map_err(AppResponseError::from)?; .map_err(AppResponseError::from)?;
@ -326,7 +326,7 @@ async fn create_collab_snapshot_handler(
.map_err(AppResponseError::from)?; .map_err(AppResponseError::from)?;
let encoded_collab_v1 = state let encoded_collab_v1 = state
.collab_storage .collab_storage
.get_collab_encoded_v1( .get_collab_encoded(
&uid, &uid,
QueryCollabParams::new(&object_id, collab_type, &workspace_id), QueryCollabParams::new(&object_id, collab_type, &workspace_id),
false, false,

View File

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