mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: integrate appflowy-cloud (#3359)
* feat: draft: code dependency * chore: update ref * feat: signup using client_api * feat: support auto sign_in after sign_up if already confirmed(WIP) * chore: update collab commit id * chore: fix compile errors * chore: user AFServer trait to provide optional service * chore: refactor workspace * chore: disable aws config * chore: return ws connect * chore: update collab rev * chore: fmt and clippy * chore: fix test * chore: update chrono version * chore: add script to update the collab crates commit id * chore: update --------- Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
@ -238,8 +238,18 @@ pub enum ErrorCode {
|
||||
|
||||
#[error("Parse url failed")]
|
||||
InvalidURL = 78,
|
||||
|
||||
#[error("Require Email Confirmation, Sign in after email confirmation")]
|
||||
AwaitingEmailConfirmation = 79,
|
||||
|
||||
#[error("Text id is empty")]
|
||||
TextIdIsEmpty = 79,
|
||||
TextIdIsEmpty = 80,
|
||||
|
||||
#[error("Record already exists")]
|
||||
RecordAlreadyExists = 81,
|
||||
|
||||
#[error("Missing payload")]
|
||||
MissingPayload = 82,
|
||||
}
|
||||
|
||||
impl ErrorCode {
|
||||
|
27
frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
Normal file
27
frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use client_api::error::AppError;
|
||||
|
||||
use crate::{ErrorCode, FlowyError};
|
||||
|
||||
impl From<AppError> for FlowyError {
|
||||
fn from(error: AppError) -> Self {
|
||||
let code = match error.code {
|
||||
client_api::error::ErrorCode::Ok => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::Unhandled => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::RecordNotFound => ErrorCode::RecordNotFound,
|
||||
client_api::error::ErrorCode::RecordAlreadyExists => ErrorCode::RecordAlreadyExists,
|
||||
client_api::error::ErrorCode::InvalidEmail => ErrorCode::EmailFormatInvalid,
|
||||
client_api::error::ErrorCode::InvalidPassword => ErrorCode::PasswordFormatInvalid,
|
||||
client_api::error::ErrorCode::OAuthError => ErrorCode::UserUnauthorized,
|
||||
client_api::error::ErrorCode::MissingPayload => ErrorCode::MissingPayload,
|
||||
client_api::error::ErrorCode::StorageError => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::OpenError => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::InvalidUrl => ErrorCode::InvalidURL,
|
||||
client_api::error::ErrorCode::InvalidRequestParams => ErrorCode::InvalidParams,
|
||||
client_api::error::ErrorCode::UrlMissingParameter => ErrorCode::InvalidParams,
|
||||
client_api::error::ErrorCode::InvalidOAuthProvider => ErrorCode::InvalidAuthConfig,
|
||||
client_api::error::ErrorCode::NotLoggedIn => ErrorCode::UserUnauthorized,
|
||||
};
|
||||
|
||||
FlowyError::new(code, error.message)
|
||||
}
|
||||
}
|
@ -22,5 +22,7 @@ mod postgres;
|
||||
#[cfg(feature = "impl_from_tokio")]
|
||||
mod tokio;
|
||||
|
||||
#[cfg(feature = "impl_from_appflowy_cloud")]
|
||||
mod cloud;
|
||||
#[cfg(feature = "impl_from_url")]
|
||||
mod url;
|
||||
|
Reference in New Issue
Block a user